mirror of
https://github.com/zilliztech/claude-context.git
synced 2025-10-06 01:10:02 +03:00
@@ -1,6 +1,6 @@
|
||||
# Contributing to Code Context
|
||||
# Contributing to Claude Context
|
||||
|
||||
Thank you for your interest in contributing to Code Context! This guide will help you get started.
|
||||
Thank you for your interest in contributing to Claude Context! This guide will help you get started.
|
||||
|
||||
## 🚀 Getting Started
|
||||
|
||||
@@ -155,8 +155,8 @@ When reporting bugs or requesting features:
|
||||
|
||||
## 📄 License
|
||||
|
||||
By contributing to Code Context, you agree that your contributions will be licensed under the MIT License.
|
||||
By contributing to Claude Context, you agree that your contributions will be licensed under the MIT License.
|
||||
|
||||
---
|
||||
|
||||
Thank you for contributing to Code Context! 🎉
|
||||
Thank you for contributing to Claude Context! 🎉
|
||||
|
||||
32
README.md
32
README.md
@@ -1,6 +1,6 @@
|
||||
<p align="center">
|
||||
<a href="https://github.com/zilliztech/claude-context">
|
||||
<img src="assets/code_context_logo_dark.png" width=600 alt="Code Context Logo">
|
||||
<img src="assets/code_context_logo_dark.png" width=600 alt="Claude Context Logo">
|
||||
</a>
|
||||
<h3 align="center"> Add Semantic Search to Claude Code</h2>
|
||||
</p>
|
||||
@@ -18,7 +18,7 @@
|
||||
<a href="https://discord.gg/mKc3R95yE5"><img height="20" src="https://img.shields.io/badge/Discord-%235865F2.svg?style=for-the-badge&logo=discord&logoColor=white" alt="discord" /></a>
|
||||
</div>
|
||||
|
||||
**Code Context** is an MCP plugin that adds semantic code search to Claude Code and other AI coding agents, giving them deep context from your entire codebase.
|
||||
**Claude Context** is an MCP plugin that adds semantic code search to Claude Code and other AI coding agents, giving them deep context from your entire codebase.
|
||||
|
||||
---
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||

|
||||
|
||||
Model Context Protocol (MCP) allows you to integrate Code Context with your favorite AI coding assistants, e.g. Claude Code.
|
||||
Model Context Protocol (MCP) allows you to integrate Claude Context with your favorite AI coding assistants, e.g. Claude Code.
|
||||
|
||||
## Quick Start
|
||||
### Prerequisites
|
||||
@@ -44,7 +44,7 @@ Model Context Protocol (MCP) allows you to integrate Code Context with your favo
|
||||
<details>
|
||||
<summary>Get a free vector database on Zilliz Cloud</summary>
|
||||
|
||||
Code Context needs a vector database. You can [sign up](https://cloud.zilliz.com/signup?utm_source=github&utm_medium=referral&utm_campaign=2507-codecontext-readme) on Zilliz Cloud to get an API key.
|
||||
Claude Context needs a vector database. You can [sign up](https://cloud.zilliz.com/signup?utm_source=github&utm_medium=referral&utm_campaign=2507-codecontext-readme) on Zilliz Cloud to get an API key.
|
||||
|
||||

|
||||
|
||||
@@ -65,10 +65,10 @@ Copy your key and use it in the configuration examples below as `your-openai-api
|
||||
|
||||
#### Claude Code Configuration
|
||||
|
||||
Use the command line interface to add the Code Context MCP server:
|
||||
Use the command line interface to add the Claude Context MCP server:
|
||||
|
||||
```bash
|
||||
# Add the Code Context MCP server
|
||||
# Add the Claude Context MCP server
|
||||
claude mcp add claude-context -e OPENAI_API_KEY=your-openai-api-key -e MILVUS_TOKEN=your-zilliz-cloud-api-key -- npx @zilliz/claude-context-mcp@latest
|
||||
```
|
||||
|
||||
@@ -226,7 +226,7 @@ Windsurf supports MCP configuration through a JSON file. Add the following confi
|
||||
<details>
|
||||
<summary><strong>VS Code</strong></summary>
|
||||
|
||||
The Code Context MCP server can be used with VS Code through MCP-compatible extensions. Add the following configuration to your VS Code MCP settings:
|
||||
The Claude Context MCP server can be used with VS Code through MCP-compatible extensions. Add the following configuration to your VS Code MCP settings:
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -299,7 +299,7 @@ Cline uses a JSON configuration file to manage MCP servers. To integrate the pro
|
||||
<details>
|
||||
<summary><strong>Augment</strong></summary>
|
||||
|
||||
To configure Code Context MCP in Augment Code, you can use either the graphical interface or manual configuration.
|
||||
To configure Claude Context MCP in Augment Code, you can use either the graphical interface or manual configuration.
|
||||
|
||||
#### **A. Using the Augment Code UI**
|
||||
|
||||
@@ -317,7 +317,7 @@ To configure Code Context MCP in Augment Code, you can use either the graphical
|
||||
npx @zilliz/claude-context-mcp@latest
|
||||
```
|
||||
|
||||
6. Name the MCP: **Code Context**.
|
||||
6. Name the MCP: **Claude Context**.
|
||||
|
||||
7. Click the **Add** button.
|
||||
|
||||
@@ -399,7 +399,7 @@ For more detailed MCP environment variable configuration, see our [Environment V
|
||||
## 🏗️ Architecture
|
||||

|
||||
|
||||
Code Context is a monorepo containing three main packages:
|
||||
Claude Context is a monorepo containing three main packages:
|
||||
|
||||
### Core Components
|
||||
|
||||
@@ -416,16 +416,16 @@ Code Context is a monorepo containing three main packages:
|
||||
|
||||
---
|
||||
|
||||
## 📦 Other Ways to Use Code Context
|
||||
## 📦 Other Ways to Use Claude Context
|
||||
|
||||
While MCP is the recommended way to use Code Context with AI assistants, you can also use it directly or through the VSCode extension.
|
||||
While MCP is the recommended way to use Claude Context with AI assistants, you can also use it directly or through the VSCode extension.
|
||||
|
||||
### Core Package Usage
|
||||
|
||||
The `@zilliz/claude-context-core` package provides the fundamental functionality for code indexing and semantic search.
|
||||
|
||||
```typescript
|
||||
import { CodeContext, MilvusVectorDatabase, OpenAIEmbedding } from '@zilliz/claude-context-core';
|
||||
import { Context, MilvusVectorDatabase, OpenAIEmbedding } from '@zilliz/claude-context-core';
|
||||
|
||||
// Initialize embedding provider
|
||||
const embedding = new OpenAIEmbedding({
|
||||
@@ -440,7 +440,7 @@ const vectorDatabase = new MilvusVectorDatabase({
|
||||
});
|
||||
|
||||
// Create context instance
|
||||
const context = new CodeContext({
|
||||
const context = new Context({
|
||||
embedding,
|
||||
vectorDatabase
|
||||
});
|
||||
@@ -462,7 +462,7 @@ results.forEach(result => {
|
||||
|
||||
### VSCode Extension
|
||||
|
||||
Integrates Code Context directly into your IDE. Provides an intuitive interface for semantic code search and navigation.
|
||||
Integrates Claude Context directly into your IDE. Provides an intuitive interface for semantic code search and navigation.
|
||||
|
||||
1. **Direct Link**: [Install from VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=zilliz.semanticcodesearch)
|
||||
2. **Manual Search**:
|
||||
@@ -515,7 +515,7 @@ pnpm dev
|
||||
|
||||
### Supported File Extensions
|
||||
|
||||
By default, Code Context supports:
|
||||
By default, Claude Context supports:
|
||||
- Programming languages: `.ts`, `.tsx`, `.js`, `.jsx`, `.py`, `.java`, `.cpp`, `.c`, `.h`, `.hpp`, `.cs`, `.go`, `.rs`, `.php`, `.rb`, `.swift`, `.kt`, `.scala`, `.m`, `.mm`
|
||||
- Documentation: `.md`, `.markdown`
|
||||
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
# Code Context Documentation
|
||||
# Claude Context Documentation
|
||||

|
||||
|
||||
Welcome to the Code Context documentation! Code Context is a powerful tool that adds semantic code search capabilities to AI coding assistants through MCP.
|
||||
Welcome to the Claude Context documentation! Claude Context is a powerful tool that adds semantic code search capabilities to AI coding assistants through MCP.
|
||||
|
||||
## 🚀 Quick Navigation
|
||||
|
||||
### Getting Started
|
||||
- [📋 Project Overview](getting-started/overview.md) - What is Code Context and how it works
|
||||
- [📋 Project Overview](getting-started/overview.md) - What is Claude Context and how it works
|
||||
- [🛠️ Prerequisites](getting-started/prerequisites.md) - What you need before starting
|
||||
- [⚡ Quick Start Guide](getting-started/quick-start.md) - Get up and running in 1 minutes
|
||||
|
||||
|
||||
### Components
|
||||
- [MCP Server](../packages/mcp/README.md) - The MCP server of Code Context
|
||||
- [VSCode Extension](../packages/vscode-extension/README.md) - The VSCode extension of Code Context
|
||||
- [Core Package](../packages/core/README.md) - The core package of Code Context
|
||||
- [MCP Server](../packages/mcp/README.md) - The MCP server of Claude Context
|
||||
- [VSCode Extension](../packages/vscode-extension/README.md) - The VSCode extension of Claude Context
|
||||
- [Core Package](../packages/core/README.md) - The core package of Claude Context
|
||||
|
||||
### Troubleshooting
|
||||
- [❓ FAQ](troubleshooting/faq.md) - Frequently asked questions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
## 🎯 Global Configuration
|
||||
|
||||
Code Context supports a global configuration file at `~/.codecontext/.env` to simplify MCP setup across different MCP clients.
|
||||
Claude Context supports a global configuration file at `~/.context/.env` to simplify MCP setup across different MCP clients.
|
||||
|
||||
**Benefits:**
|
||||
- Configure once, use everywhere
|
||||
@@ -12,7 +12,7 @@ Code Context supports a global configuration file at `~/.codecontext/.env` to si
|
||||
## 📋 Environment Variable Priority
|
||||
|
||||
1. **Process Environment Variables** (highest)
|
||||
2. **Global Configuration File** (`~/.codecontext/.env`)
|
||||
2. **Global Configuration File** (`~/.context/.env`)
|
||||
3. **Default Values** (lowest)
|
||||
|
||||
## 🔧 Required Environment Variables
|
||||
@@ -49,8 +49,8 @@ Code Context supports a global configuration file at `~/.codecontext/.env` to si
|
||||
|
||||
### 1. Create Global Config
|
||||
```bash
|
||||
mkdir -p ~/.codecontext
|
||||
cat > ~/.codecontext/.env << 'EOF'
|
||||
mkdir -p ~/.context
|
||||
cat > ~/.context/.env << 'EOF'
|
||||
EMBEDDING_PROVIDER=OpenAI
|
||||
OPENAI_API_KEY=sk-your-openai-api-key
|
||||
MILVUS_TOKEN=your-zilliz-cloud-api-key
|
||||
@@ -79,5 +79,5 @@ claude mcp add claude-context -- npx @zilliz/claude-context-mcp@latest
|
||||
## 📚 Additional Information
|
||||
|
||||
For detailed information about file processing rules and how custom patterns work, see:
|
||||
- [What files does Code Context decide to embed?](../troubleshooting/faq.md#q-what-files-does-claude-context-decide-to-embed)
|
||||
- [What files does Claude Context decide to embed?](../troubleshooting/faq.md#q-what-files-does-claude-context-decide-to-embed)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# Project Overview
|
||||
|
||||
## What is Code Context?
|
||||
## What is Claude Context?
|
||||
|
||||
Code Context is a powerful semantic code search tool that gives AI coding assistants deep understanding of your entire codebase. Instead of traditional keyword-based search, Code Context uses vector embeddings and AI to understand the meaning and context of your code.
|
||||
Claude Context is a powerful semantic code search tool that gives AI coding assistants deep understanding of your entire codebase. Instead of traditional keyword-based search, Claude Context uses vector embeddings and AI to understand the meaning and context of your code.
|
||||
|
||||
## Key Features
|
||||
|
||||
@@ -27,7 +27,7 @@ Configure file extensions, ignore patterns, embedding models, and search paramet
|
||||
## How It Works
|
||||
|
||||
### 1. Code Analysis
|
||||
Code Context analyzes your codebase using AST parsers to understand code structure and semantics.
|
||||
Claude Context analyzes your codebase using AST parsers to understand code structure and semantics.
|
||||
|
||||
### 2. Intelligent Chunking
|
||||
Code is split into meaningful chunks that preserve context, function boundaries, and logical groupings.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Prerequisites
|
||||
|
||||
Before setting up Code Context, ensure you have the following requirements met.
|
||||
Before setting up Claude Context, ensure you have the following requirements met.
|
||||
|
||||
## Required Services
|
||||
|
||||
@@ -42,7 +42,7 @@ Before setting up Code Context, ensure you have the following requirements met.
|
||||
|
||||
### For VSCode Extension
|
||||
- **VSCode**: Version 1.74.0 or higher
|
||||
- **Extensions**: Code Context extension from marketplace
|
||||
- **Extensions**: Claude Context extension from marketplace
|
||||
|
||||
|
||||
### For Development Contributions
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Quick Start Guide
|
||||
|
||||
Get Code Context running with AI assistants in under 5 minutes! This guide covers the most common setup using MCP (Model Context Protocol) with Claude Code.
|
||||
Get Claude Context running with AI assistants in under 5 minutes! This guide covers the most common setup using MCP (Model Context Protocol) with Claude Code.
|
||||
|
||||
## 🚀 1-Minute Setup for Claude Code
|
||||
|
||||
@@ -14,7 +14,7 @@ You'll need two API keys:
|
||||
|
||||
### Step 2: Configure Claude Code
|
||||
|
||||
Run this single command to add Code Context to Claude Code:
|
||||
Run this single command to add Claude Context to Claude Code:
|
||||
|
||||
```bash
|
||||
claude mcp add claude-context \
|
||||
@@ -25,7 +25,7 @@ claude mcp add claude-context \
|
||||
|
||||
Replace the API keys with your actual keys.
|
||||
|
||||
### Step 3: Start Using Code Context
|
||||
### Step 3: Start Using Claude Context
|
||||
|
||||
1. **Open Claude Code** in your project directory
|
||||
2. **Index your codebase**:
|
||||
@@ -167,10 +167,10 @@ Add to your Claude Desktop configuration:
|
||||
<details>
|
||||
<summary><strong>Claude Code</strong></summary>
|
||||
|
||||
Use the command line interface to add the CodeContext MCP server:
|
||||
Use the command line interface to add the Claude Context MCP server:
|
||||
|
||||
```bash
|
||||
# Add the CodeContext MCP server
|
||||
# Add the Claude Context MCP server
|
||||
claude mcp add claude-context -e OPENAI_API_KEY=your-openai-api-key -e MILVUS_TOKEN=your-zilliz-cloud-api-key -- npx @zilliz/claude-context-mcp@latest
|
||||
|
||||
```
|
||||
@@ -204,7 +204,7 @@ Windsurf supports MCP configuration through a JSON file. Add the following confi
|
||||
<details>
|
||||
<summary><strong>VS Code</strong></summary>
|
||||
|
||||
The CodeContext MCP server can be used with VS Code through MCP-compatible extensions. Add the following configuration to your VS Code MCP settings:
|
||||
The Claude Context MCP server can be used with VS Code through MCP-compatible extensions. Add the following configuration to your VS Code MCP settings:
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -275,7 +275,7 @@ Cline uses a JSON configuration file to manage MCP servers. To integrate the pro
|
||||
<details>
|
||||
<summary><strong>Augment</strong></summary>
|
||||
|
||||
To configure Code Context MCP in Augment Code, you can use either the graphical interface or manual configuration.
|
||||
To configure Claude Context MCP in Augment Code, you can use either the graphical interface or manual configuration.
|
||||
|
||||
#### **A. Using the Augment Code UI**
|
||||
|
||||
@@ -293,7 +293,7 @@ To configure Code Context MCP in Augment Code, you can use either the graphical
|
||||
npx @zilliz/claude-context-mcp@latest
|
||||
```
|
||||
|
||||
6. Name the MCP: **Code Context**.
|
||||
6. Name the MCP: **Claude Context**.
|
||||
|
||||
7. Click the **Add** button.
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# Frequently Asked Questions (FAQ)
|
||||
|
||||
## Q: What files does Code Context decide to embed?
|
||||
## Q: What files does Claude Context decide to embed?
|
||||
|
||||
**A:** Code Context embeds files based on the following rules:
|
||||
**A:** Claude Context embeds files based on the following rules:
|
||||
|
||||
**Files that are included:**
|
||||
- Files with supported extensions from multiple sources:
|
||||
@@ -17,9 +17,9 @@
|
||||
- Environment variable custom ignore patterns (via `CUSTOM_IGNORE_PATTERNS`)
|
||||
- Files matching patterns in .gitignore
|
||||
- Files matching patterns in any .xxxignore files (e.g., .cursorignore, .codeiumignore)
|
||||
- Files matching patterns in global ~/.codecontext/.codecontextignore
|
||||
- Files matching patterns in global ~/.context/.contextignore
|
||||
|
||||
The final rule is: `(DEFAULT_SUPPORTED_EXTENSIONS + MCP custom extensions + custom extensions from env variable) - (DEFAULT_IGNORE_PATTERNS + MCP custom ignore patterns + custom ignore patterns from env variable + .gitignore + .xxxignore files + global .codecontextignore)`
|
||||
The final rule is: `(DEFAULT_SUPPORTED_EXTENSIONS + MCP custom extensions + custom extensions from env variable) - (DEFAULT_IGNORE_PATTERNS + MCP custom ignore patterns + custom ignore patterns from env variable + .gitignore + .xxxignore files + global .contextignore)`
|
||||
|
||||
**Extension sources (all patterns are combined):**
|
||||
1. **Default extensions**: Built-in supported file extensions (.ts, .js, .py, .java, .cpp, .md, etc.)
|
||||
@@ -32,7 +32,7 @@ The final rule is: `(DEFAULT_SUPPORTED_EXTENSIONS + MCP custom extensions + cust
|
||||
3. **Environment custom ignore patterns**: Patterns from `CUSTOM_IGNORE_PATTERNS` env variable (comma-separated)
|
||||
4. **.gitignore**: Standard Git ignore patterns in codebase root
|
||||
5. **.xxxignore files**: Any file in codebase root matching pattern `.xxxignore` (e.g., `.cursorignore`, `.codeiumignore`)
|
||||
6. **Global ignore**: `~/.codecontext/.codecontextignore` for user-wide patterns
|
||||
6. **Global ignore**: `~/.context/.contextignore` for user-wide patterns
|
||||
|
||||
All patterns are merged together - MCP custom patterns and environment variables will NOT be overwritten by file-based patterns.
|
||||
|
||||
@@ -42,7 +42,7 @@ All patterns are merged together - MCP custom patterns and environment variables
|
||||
|
||||
These environment variables can be set in:
|
||||
- System environment variables (highest priority)
|
||||
- Global `~/.codecontext/.env` file (lower priority)
|
||||
- Global `~/.context/.env` file (lower priority)
|
||||
|
||||
Supported extensions include common programming languages (.ts, .js, .py, .java, .cpp, etc.) and documentation files (.md, .markdown). Default ignore patterns cover build outputs, dependencies (node_modules), IDE files, and temporary files.
|
||||
|
||||
@@ -50,7 +50,7 @@ Supported extensions include common programming languages (.ts, .js, .py, .java,
|
||||
|
||||
## Q: Can I use a fully local deployment setup?
|
||||
|
||||
**A:** Yes, you can deploy Code Context entirely on your local infrastructure. While we recommend using the fully managed [Zilliz Cloud](https://cloud.zilliz.com/signup?utm_source=github&utm_medium=referral&utm_campaign=2507-codecontext-readme) service for ease of use, you can also set up your own private local deployment.
|
||||
**A:** Yes, you can deploy Claude Context entirely on your local infrastructure. While we recommend using the fully managed [Zilliz Cloud](https://cloud.zilliz.com/signup?utm_source=github&utm_medium=referral&utm_campaign=2507-codecontext-readme) service for ease of use, you can also set up your own private local deployment.
|
||||
|
||||
**For local deployment:**
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
# Code Context Examples
|
||||
# Claude Context Examples
|
||||
|
||||
This directory contains usage examples for Code Context.
|
||||
This directory contains usage examples for Claude Context.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Basic Usage Example
|
||||
|
||||
This example demonstrates the basic usage of Code Context.
|
||||
This example demonstrates the basic usage of Claude Context.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
@@ -40,14 +40,14 @@ This example demonstrates the basic usage of Code Context.
|
||||
```
|
||||
|
||||
## What This Example Does
|
||||
1. **Indexes Codebase**: Indexes the entire Code Context project
|
||||
1. **Indexes Codebase**: Indexes the entire Claude Context project
|
||||
2. **Performs Searches**: Executes semantic searches for different code patterns
|
||||
3. **Shows Results**: Displays search results with similarity scores and file locations
|
||||
|
||||
## Expected Output
|
||||
|
||||
```
|
||||
🚀 Code Context Real Usage Example
|
||||
🚀 Claude Context Real Usage Example
|
||||
===============================
|
||||
...
|
||||
🔌 Connecting to vector database at: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { CodeContext, MilvusVectorDatabase, MilvusRestfulVectorDatabase, AstCodeSplitter, LangChainCodeSplitter } from '@zilliz/claude-context-core';
|
||||
import { Context, MilvusVectorDatabase, MilvusRestfulVectorDatabase, AstCodeSplitter, LangChainCodeSplitter } from '@zilliz/claude-context-core';
|
||||
import { envManager } from '@zilliz/claude-context-core';
|
||||
import * as path from 'path';
|
||||
|
||||
@@ -10,7 +10,7 @@ try {
|
||||
}
|
||||
|
||||
async function main() {
|
||||
console.log('🚀 CodeContext Real Usage Example');
|
||||
console.log('🚀 Context Real Usage Example');
|
||||
console.log('===============================');
|
||||
|
||||
try {
|
||||
@@ -40,14 +40,14 @@ async function main() {
|
||||
});
|
||||
}
|
||||
|
||||
// 2. Create CodeContext instance
|
||||
// 2. Create Context instance
|
||||
let codeSplitter;
|
||||
if (splitterType === 'langchain') {
|
||||
codeSplitter = new LangChainCodeSplitter(1000, 200);
|
||||
} else {
|
||||
codeSplitter = new AstCodeSplitter(2500, 300);
|
||||
}
|
||||
const context = new CodeContext({
|
||||
const context = new Context({
|
||||
vectorDatabase,
|
||||
codeSplitter,
|
||||
supportedExtensions: ['.ts', '.js', '.py', '.java', '.cpp', '.go', '.rs']
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "claude-context-basic-example",
|
||||
"version": "0.0.1",
|
||||
"description": "Basic usage example for Code Context",
|
||||
"description": "Basic usage example for Claude Context",
|
||||
"main": "index.ts",
|
||||
"scripts": {
|
||||
"start": "tsx index.ts",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Contributing to Chrome Extension
|
||||
|
||||
Thanks for your interest in contributing to the Code Context Chrome extension!
|
||||
Thanks for your interest in contributing to the Claude Context Chrome extension!
|
||||
|
||||
> 📖 **First time contributing?** Please read the [main contributing guide](../../CONTRIBUTING.md) first for general setup and workflow.
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# GitHub Code Vector Search Chrome Extension
|
||||
|
||||
A Chrome extension for indexing and semantically searching GitHub repository code, powered by Code Context.
|
||||
A Chrome extension for indexing and semantically searching GitHub repository code, powered by Claude Context.
|
||||
|
||||
> 📖 **New to Code Context?** Check out the [main project README](../../README.md) for an overview and setup instructions.
|
||||
> 📖 **New to Claude Context?** Check out the [main project README](../../README.md) for an overview and setup instructions.
|
||||
|
||||
## Features
|
||||
|
||||
@@ -109,7 +109,7 @@ The extension requires the following permissions:
|
||||
|
||||
## Contributing
|
||||
|
||||
This Chrome extension is part of the Code Context monorepo. Please see:
|
||||
This Chrome extension is part of the Claude Context monorepo. Please see:
|
||||
- [Main Contributing Guide](../../CONTRIBUTING.md) - General contribution guidelines
|
||||
- [Chrome Extension Contributing](CONTRIBUTING.md) - Specific development guide for this extension
|
||||
|
||||
@@ -124,7 +124,7 @@ This Chrome extension is part of the Code Context monorepo. Please see:
|
||||
- **TypeScript** - Type-safe development
|
||||
- **Chrome Extension Manifest V3** - Modern extension architecture
|
||||
- **Webpack** - Module bundling and optimization
|
||||
- **Code Context Core** - Semantic search engine
|
||||
- **Claude Context Core** - Semantic search engine
|
||||
- **Milvus Vector Database** - Vector storage and retrieval
|
||||
- **OpenAI/VoyageAI Embeddings** - Text embedding generation
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@zilliz/claude-context-chrome-extension",
|
||||
"version": "0.0.1",
|
||||
"description": "Code Context Chrome extension for web-based code indexing",
|
||||
"description": "Claude Context Chrome extension for web-based code indexing",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "webpack --mode=production",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Contributing to @zilliz/claude-context-core
|
||||
|
||||
Thanks for your interest in contributing to the Code Context core package!
|
||||
Thanks for your interest in contributing to the Claude Context core package!
|
||||
|
||||
> 📖 **First time contributing?** Please read the [main contributing guide](../../CONTRIBUTING.md) first for general setup and workflow.
|
||||
|
||||
@@ -27,7 +27,7 @@ pnpm dev:core
|
||||
|
||||
## Project Structure
|
||||
|
||||
- `src/context.ts` - Main CodeContext class
|
||||
- `src/context.ts` - Main Claude Context class
|
||||
- `src/embedding/` - Embedding providers (OpenAI, VoyageAI, Ollama)
|
||||
- `src/vectordb/` - Vector database implementations (Milvus)
|
||||
- `src/splitter/` - Code splitting logic
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
# @zilliz/claude-context-core
|
||||

|
||||
|
||||
The core indexing engine for Code Context - a powerful tool for semantic search and analysis of codebases using vector embeddings and AI.
|
||||
The core indexing engine for Claude Context - a powerful tool for semantic search and analysis of codebases using vector embeddings and AI.
|
||||
|
||||
[](https://www.npmjs.com/package/@zilliz/claude-context-core)
|
||||
[](https://www.npmjs.com/package/@zilliz/claude-context-core)
|
||||
|
||||
> 📖 **New to Code Context?** Check out the [main project README](../../README.md) for an overview and quick start guide.
|
||||
> 📖 **New to Claude Context?** Check out the [main project README](../../README.md) for an overview and quick start guide.
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -24,7 +24,7 @@ OPENAI_API_KEY=your-openai-api-key
|
||||
#### Zilliz Cloud configuration
|
||||
Get a free Milvus vector database on Zilliz Cloud.
|
||||
|
||||
Code Context needs a vector database. You can [sign up](https://cloud.zilliz.com/signup?utm_source=github&utm_medium=referral&utm_campaign=2507-codecontext-readme) on Zilliz Cloud to get a free Serverless cluster.
|
||||
Claude Context needs a vector database. You can [sign up](https://cloud.zilliz.com/signup?utm_source=github&utm_medium=referral&utm_campaign=2507-codecontext-readme) on Zilliz Cloud to get a free Serverless cluster.
|
||||
|
||||

|
||||
|
||||
@@ -48,7 +48,7 @@ MILVUS_TOKEN=your-zilliz-cloud-api-key
|
||||
|
||||
```typescript
|
||||
import {
|
||||
CodeContext,
|
||||
Context,
|
||||
OpenAIEmbedding,
|
||||
MilvusVectorDatabase
|
||||
} from '@zilliz/claude-context-core';
|
||||
@@ -66,7 +66,7 @@ const vectorDatabase = new MilvusVectorDatabase({
|
||||
});
|
||||
|
||||
// Create context instance
|
||||
const context = new CodeContext({
|
||||
const context = new Context({
|
||||
embedding,
|
||||
vectorDatabase
|
||||
});
|
||||
@@ -118,10 +118,10 @@ results.forEach(result => {
|
||||
|
||||
## Configuration
|
||||
|
||||
### CodeContextConfig
|
||||
### ContextConfig
|
||||
|
||||
```typescript
|
||||
interface CodeContextConfig {
|
||||
interface ContextConfig {
|
||||
embedding?: Embedding; // Embedding provider
|
||||
vectorDatabase?: VectorDatabase; // Vector database instance (required)
|
||||
codeSplitter?: Splitter; // Code splitting strategy
|
||||
@@ -151,7 +151,7 @@ interface CodeContextConfig {
|
||||
|
||||
## API Reference
|
||||
|
||||
### CodeContext
|
||||
### Context
|
||||
|
||||
#### Methods
|
||||
|
||||
@@ -183,7 +183,7 @@ interface SemanticSearchResult {
|
||||
### Using VoyageAI Embeddings
|
||||
|
||||
```typescript
|
||||
import { CodeContext, MilvusVectorDatabase, VoyageAIEmbedding } from '@zilliz/claude-context-core';
|
||||
import { Context, MilvusVectorDatabase, VoyageAIEmbedding } from '@zilliz/claude-context-core';
|
||||
|
||||
// Initialize with VoyageAI embedding provider
|
||||
const embedding = new VoyageAIEmbedding({
|
||||
@@ -196,7 +196,7 @@ const vectorDatabase = new MilvusVectorDatabase({
|
||||
token: process.env.MILVUS_TOKEN || ''
|
||||
});
|
||||
|
||||
const context = new CodeContext({
|
||||
const context = new Context({
|
||||
embedding,
|
||||
vectorDatabase
|
||||
});
|
||||
@@ -205,7 +205,7 @@ const context = new CodeContext({
|
||||
### Custom File Filtering
|
||||
|
||||
```typescript
|
||||
const context = new CodeContext({
|
||||
const context = new Context({
|
||||
embedding,
|
||||
vectorDatabase,
|
||||
supportedExtensions: ['.ts', '.js', '.py', '.java'],
|
||||
@@ -220,7 +220,7 @@ const context = new CodeContext({
|
||||
|
||||
## File Synchronization Architecture
|
||||
|
||||
Code Context implements an intelligent file synchronization system that efficiently tracks and processes only the files that have changed since the last indexing operation. This dramatically improves performance when working with large codebases.
|
||||
Claude Context implements an intelligent file synchronization system that efficiently tracks and processes only the files that have changed since the last indexing operation. This dramatically improves performance when working with large codebases.
|
||||
|
||||

|
||||
|
||||
@@ -239,7 +239,7 @@ The file synchronization system uses a **Merkle tree-based approach** combined w
|
||||
- Any change to any file will cause the root hash to change
|
||||
|
||||
#### 3. Snapshot Management
|
||||
- File synchronization state is persisted to `~/.codecontext/merkle/` directory
|
||||
- File synchronization state is persisted to `~/.context/merkle/` directory
|
||||
- Each codebase gets a unique snapshot file based on its absolute path hash
|
||||
- Snapshots contain both file hashes and serialized Merkle tree data
|
||||
|
||||
@@ -260,7 +260,7 @@ The file synchronization system uses a **Merkle tree-based approach** combined w
|
||||
|
||||
## Contributing
|
||||
|
||||
This package is part of the CodeContext monorepo. Please see:
|
||||
This package is part of the Claude Context monorepo. Please see:
|
||||
- [Main Contributing Guide](../../CONTRIBUTING.md) - General contribution guidelines
|
||||
- [Core Package Contributing](CONTRIBUTING.md) - Specific development guide for this package
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@zilliz/claude-context-core",
|
||||
"version": "0.0.1",
|
||||
"description": "Core indexing engine for Code Context",
|
||||
"description": "Core indexing engine for Claude Context",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"scripts": {
|
||||
|
||||
@@ -83,7 +83,7 @@ const DEFAULT_IGNORE_PATTERNS = [
|
||||
'coverage', '.nyc_output', 'logs', 'tmp', 'temp'
|
||||
];
|
||||
|
||||
export interface CodeContextConfig {
|
||||
export interface ContextConfig {
|
||||
embedding?: Embedding;
|
||||
vectorDatabase?: VectorDatabase;
|
||||
codeSplitter?: Splitter;
|
||||
@@ -93,7 +93,7 @@ export interface CodeContextConfig {
|
||||
customIgnorePatterns?: string[]; // New: custom ignore patterns from MCP
|
||||
}
|
||||
|
||||
export class CodeContext {
|
||||
export class Context {
|
||||
private embedding: Embedding;
|
||||
private vectorDatabase: VectorDatabase;
|
||||
private codeSplitter: Splitter;
|
||||
@@ -101,7 +101,7 @@ export class CodeContext {
|
||||
private ignorePatterns: string[];
|
||||
private synchronizers = new Map<string, FileSynchronizer>();
|
||||
|
||||
constructor(config: CodeContextConfig = {}) {
|
||||
constructor(config: ContextConfig = {}) {
|
||||
// Initialize services
|
||||
this.embedding = config.embedding || new OpenAIEmbedding({
|
||||
apiKey: envManager.get('OPENAI_API_KEY') || 'your-openai-api-key',
|
||||
@@ -738,7 +738,7 @@ export class CodeContext {
|
||||
fileBasedPatterns.push(...patterns);
|
||||
}
|
||||
|
||||
// 3. Load global ~/.codecontext/.codecontextignore
|
||||
// 3. Load global ~/.context/.contextignore
|
||||
const globalIgnorePatterns = await this.loadGlobalIgnoreFile();
|
||||
fileBasedPatterns.push(...globalIgnorePatterns);
|
||||
|
||||
@@ -786,14 +786,14 @@ export class CodeContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* Load global ignore file from ~/.codecontext/.codecontextignore
|
||||
* Load global ignore file from ~/.context/.contextignore
|
||||
* @returns Array of ignore patterns
|
||||
*/
|
||||
private async loadGlobalIgnoreFile(): Promise<string[]> {
|
||||
try {
|
||||
const homeDir = require('os').homedir();
|
||||
const globalIgnorePath = path.join(homeDir, '.codecontext', '.codecontextignore');
|
||||
return await this.loadIgnoreFile(globalIgnorePath, 'global .codecontextignore');
|
||||
const globalIgnorePath = path.join(homeDir, '.context', '.contextignore');
|
||||
return await this.loadIgnoreFile(globalIgnorePath, 'global .contextignore');
|
||||
} catch (error) {
|
||||
// Global ignore file is optional, don't log warnings
|
||||
return [];
|
||||
@@ -811,7 +811,7 @@ export class CodeContext {
|
||||
await fs.promises.access(filePath);
|
||||
console.log(`📄 Found ${fileName} file at: ${filePath}`);
|
||||
|
||||
const ignorePatterns = await CodeContext.getIgnorePatternsFromFile(filePath);
|
||||
const ignorePatterns = await Context.getIgnorePatternsFromFile(filePath);
|
||||
|
||||
if (ignorePatterns.length > 0) {
|
||||
console.log(`🚫 Loaded ${ignorePatterns.length} ignore patterns from ${fileName}`);
|
||||
|
||||
@@ -21,7 +21,7 @@ export class FileSynchronizer {
|
||||
|
||||
private getSnapshotPath(codebasePath: string): string {
|
||||
const homeDir = os.homedir();
|
||||
const merkleDir = path.join(homeDir, '.codecontext', 'merkle');
|
||||
const merkleDir = path.join(homeDir, '.context', 'merkle');
|
||||
|
||||
const normalizedPath = path.resolve(codebasePath);
|
||||
const hash = crypto.createHash('md5').update(normalizedPath).digest('hex');
|
||||
@@ -328,7 +328,7 @@ export class FileSynchronizer {
|
||||
*/
|
||||
static async deleteSnapshot(codebasePath: string): Promise<void> {
|
||||
const homeDir = os.homedir();
|
||||
const merkleDir = path.join(homeDir, '.codecontext', 'merkle');
|
||||
const merkleDir = path.join(homeDir, '.context', 'merkle');
|
||||
const normalizedPath = path.resolve(codebasePath);
|
||||
const hash = crypto.createHash('md5').update(normalizedPath).digest('hex');
|
||||
const snapshotPath = path.join(merkleDir, `${hash}.json`);
|
||||
|
||||
@@ -7,7 +7,7 @@ export class EnvManager {
|
||||
|
||||
constructor() {
|
||||
const homeDir = os.homedir();
|
||||
this.envFilePath = path.join(homeDir, '.codecontext', '.env');
|
||||
this.envFilePath = path.join(homeDir, '.context', '.env');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -153,7 +153,7 @@ export class MilvusVectorDatabase implements VectorDatabase {
|
||||
|
||||
const createCollectionParams = {
|
||||
collection_name: collectionName,
|
||||
description: description || `Code context collection: ${collectionName}`,
|
||||
description: description || `Claude Context collection: ${collectionName}`,
|
||||
fields: schema,
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Contributing to @zilliz/claude-context-mcp
|
||||
|
||||
Thanks for your interest in contributing to the Code Context MCP server!
|
||||
Thanks for your interest in contributing to the Claude Context MCP server!
|
||||
|
||||
> 📖 **First time contributing?** Please read the [main contributing guide](../../CONTRIBUTING.md) first for general setup and workflow.
|
||||
|
||||
@@ -89,7 +89,7 @@ You can use the following configuration to configure the MCP server with a devel
|
||||
"mcpServers": {
|
||||
"claude-context-local": {
|
||||
"command": "node",
|
||||
"args": ["PATH_TO_CODECONTEXT/packages/mcp/dist/index.js"],
|
||||
"args": ["PATH_TO_CLAUDECONTEXT/packages/mcp/dist/index.js"],
|
||||
"env": {
|
||||
"OPENAI_API_KEY": "sk-your-openai-api-key",
|
||||
"MILVUS_TOKEN": "your-zilliz-cloud-api-key"
|
||||
@@ -101,7 +101,7 @@ You can use the following configuration to configure the MCP server with a devel
|
||||
|
||||
### Claude Code Development Mode Configuration
|
||||
```bash
|
||||
claude mcp add claude-context -e OPENAI_API_KEY=sk-your-openai-api-key -e MILVUS_TOKEN=your-zilliz-cloud-api-key -- node PATH_TO_CODECONTEXT/packages/mcp/dist/index.js
|
||||
claude mcp add claude-context -e OPENAI_API_KEY=sk-your-openai-api-key -e MILVUS_TOKEN=your-zilliz-cloud-api-key -- node PATH_TO_CLAUDECONTEXT/packages/mcp/dist/index.js
|
||||
```
|
||||
And then you can start Claude Code with `claude --debug` to see the MCP server logs.
|
||||
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
# @zilliz/claude-context-mcp
|
||||

|
||||
Model Context Protocol (MCP) integration for Code Context - A powerful MCP server that enables AI assistants and agents to index and search codebases using semantic search.
|
||||
Model Context Protocol (MCP) integration for Claude Context - A powerful MCP server that enables AI assistants and agents to index and search codebases using semantic search.
|
||||
|
||||
[](https://www.npmjs.com/package/@zilliz/claude-context-mcp)
|
||||
[](https://www.npmjs.com/package/@zilliz/claude-context-mcp)
|
||||
|
||||
> 📖 **New to Code Context?** Check out the [main project README](../../README.md) for an overview and setup instructions.
|
||||
> 📖 **New to Claude Context?** Check out the [main project README](../../README.md) for an overview and setup instructions.
|
||||
|
||||
|
||||
## 🚀 Use Code Context as MCP in Claude Code and others
|
||||
## 🚀 Use Claude Context as MCP in Claude Code and others
|
||||
|
||||

|
||||
|
||||
Model Context Protocol (MCP) allows you to integrate Code Context with your favorite AI coding assistants, e.g. Claude Code.
|
||||
Model Context Protocol (MCP) allows you to integrate Claude Context with your favorite AI coding assistants, e.g. Claude Code.
|
||||
|
||||
|
||||
## Quick Start
|
||||
@@ -29,7 +29,7 @@ Before using the MCP server, make sure you have:
|
||||
|
||||
#### Embedding Provider Configuration
|
||||
|
||||
Code Context MCP supports multiple embedding providers. Choose the one that best fits your needs:
|
||||
Claude Context MCP supports multiple embedding providers. Choose the one that best fits your needs:
|
||||
|
||||
> 💡 **Tip**: You can also use [global environment variables](../../docs/getting-started/environment-variables.md) for easier configuration management across different MCP clients.
|
||||
|
||||
@@ -150,7 +150,7 @@ OLLAMA_HOST=http://127.0.0.1:11434
|
||||
|
||||
#### Get a free vector database on Zilliz Cloud
|
||||
|
||||
Code Context needs a vector database. You can [sign up](https://cloud.zilliz.com/signup?utm_source=github&utm_medium=referral&utm_campaign=2507-codecontext-readme) on Zilliz Cloud to get an API key.
|
||||
Claude Context needs a vector database. You can [sign up](https://cloud.zilliz.com/signup?utm_source=github&utm_medium=referral&utm_campaign=2507-codecontext-readme) on Zilliz Cloud to get an API key.
|
||||
|
||||

|
||||
|
||||
@@ -309,10 +309,10 @@ Add to your Claude Desktop configuration:
|
||||
<details>
|
||||
<summary><strong>Claude Code</strong></summary>
|
||||
|
||||
Use the command line interface to add the CodeContext MCP server:
|
||||
Use the command line interface to add the Claude Context MCP server:
|
||||
|
||||
```bash
|
||||
# Add the CodeContext MCP server
|
||||
# Add the Claude Context MCP server
|
||||
claude mcp add claude-context -e OPENAI_API_KEY=your-openai-api-key -e MILVUS_TOKEN=your-zilliz-cloud-api-key -- npx @zilliz/claude-context-mcp@latest
|
||||
|
||||
```
|
||||
@@ -346,7 +346,7 @@ Windsurf supports MCP configuration through a JSON file. Add the following confi
|
||||
<details>
|
||||
<summary><strong>VS Code</strong></summary>
|
||||
|
||||
The CodeContext MCP server can be used with VS Code through MCP-compatible extensions. Add the following configuration to your VS Code MCP settings:
|
||||
The Claude Context MCP server can be used with VS Code through MCP-compatible extensions. Add the following configuration to your VS Code MCP settings:
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -416,7 +416,7 @@ Cline uses a JSON configuration file to manage MCP servers. To integrate the pro
|
||||
<details>
|
||||
<summary><strong>Augment</strong></summary>
|
||||
|
||||
To configure Code Context MCP in Augment Code, you can use either the graphical interface or manual configuration.
|
||||
To configure Claude Context MCP in Augment Code, you can use either the graphical interface or manual configuration.
|
||||
|
||||
#### **A. Using the Augment Code UI**
|
||||
|
||||
@@ -434,7 +434,7 @@ To configure Code Context MCP in Augment Code, you can use either the graphical
|
||||
npx @zilliz/claude-context-mcp@latest
|
||||
```
|
||||
|
||||
6. Name the MCP: **Code Context**.
|
||||
6. Name the MCP: **Claude Context**.
|
||||
|
||||
7. Click the **Add** button.
|
||||
|
||||
@@ -567,7 +567,7 @@ Clear the search index for a specific codebase.
|
||||
|
||||
## Contributing
|
||||
|
||||
This package is part of the CodeContext monorepo. Please see:
|
||||
This package is part of the Claude Context monorepo. Please see:
|
||||
- [Main Contributing Guide](../../CONTRIBUTING.md) - General contribution guidelines
|
||||
- [MCP Package Contributing](CONTRIBUTING.md) - Specific development guide for this package
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@zilliz/claude-context-mcp",
|
||||
"version": "0.0.1",
|
||||
"description": "Model Context Protocol integration for Code Context",
|
||||
"description": "Model Context Protocol integration for Claude Context",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { envManager } from "@zilliz/claude-context-core";
|
||||
|
||||
export interface CodeContextMcpConfig {
|
||||
export interface ContextMcpConfig {
|
||||
name: string;
|
||||
version: string;
|
||||
// Embedding provider configuration
|
||||
@@ -58,8 +58,8 @@ export function getEmbeddingModelForProvider(provider: string): string {
|
||||
}
|
||||
}
|
||||
|
||||
export function createMcpConfig(): CodeContextMcpConfig {
|
||||
// Debug: Print all environment variables related to CodeContext
|
||||
export function createMcpConfig(): ContextMcpConfig {
|
||||
// Debug: Print all environment variables related to Context
|
||||
console.log(`[DEBUG] 🔍 Environment Variables Debug:`);
|
||||
console.log(`[DEBUG] EMBEDDING_PROVIDER: ${envManager.get('EMBEDDING_PROVIDER') || 'NOT SET'}`);
|
||||
console.log(`[DEBUG] EMBEDDING_MODEL: ${envManager.get('EMBEDDING_MODEL') || 'NOT SET'}`);
|
||||
@@ -69,8 +69,8 @@ export function createMcpConfig(): CodeContextMcpConfig {
|
||||
console.log(`[DEBUG] MILVUS_ADDRESS: ${envManager.get('MILVUS_ADDRESS') || 'NOT SET'}`);
|
||||
console.log(`[DEBUG] NODE_ENV: ${envManager.get('NODE_ENV') || 'NOT SET'}`);
|
||||
|
||||
const config: CodeContextMcpConfig = {
|
||||
name: envManager.get('MCP_SERVER_NAME') || "CodeContext MCP Server",
|
||||
const config: ContextMcpConfig = {
|
||||
name: envManager.get('MCP_SERVER_NAME') || "Context MCP Server",
|
||||
version: envManager.get('MCP_SERVER_VERSION') || "1.0.0",
|
||||
// Embedding provider configuration
|
||||
embeddingProvider: (envManager.get('EMBEDDING_PROVIDER') as 'OpenAI' | 'VoyageAI' | 'Gemini' | 'Ollama') || 'OpenAI',
|
||||
@@ -91,9 +91,9 @@ export function createMcpConfig(): CodeContextMcpConfig {
|
||||
return config;
|
||||
}
|
||||
|
||||
export function logConfigurationSummary(config: CodeContextMcpConfig): void {
|
||||
export function logConfigurationSummary(config: ContextMcpConfig): void {
|
||||
// Log configuration summary before starting server
|
||||
console.log(`[MCP] 🚀 Starting CodeContext MCP Server`);
|
||||
console.log(`[MCP] 🚀 Starting Context MCP Server`);
|
||||
console.log(`[MCP] Configuration Summary:`);
|
||||
console.log(`[MCP] Server: ${config.name} v${config.version}`);
|
||||
console.log(`[MCP] Embedding Provider: ${config.embeddingProvider}`);
|
||||
@@ -125,7 +125,7 @@ export function logConfigurationSummary(config: CodeContextMcpConfig): void {
|
||||
|
||||
export function showHelpMessage(): void {
|
||||
console.log(`
|
||||
CodeContext MCP Server
|
||||
Context MCP Server
|
||||
|
||||
Usage: npx @zilliz/claude-context-mcp@latest [options]
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { OpenAIEmbedding, VoyageAIEmbedding, GeminiEmbedding, OllamaEmbedding } from "@zilliz/claude-context-core";
|
||||
import { CodeContextMcpConfig } from "./config.js";
|
||||
import { ContextMcpConfig } from "./config.js";
|
||||
|
||||
// Helper function to create embedding instance based on provider
|
||||
export function createEmbeddingInstance(config: CodeContextMcpConfig): OpenAIEmbedding | VoyageAIEmbedding | GeminiEmbedding | OllamaEmbedding {
|
||||
export function createEmbeddingInstance(config: ContextMcpConfig): OpenAIEmbedding | VoyageAIEmbedding | GeminiEmbedding | OllamaEmbedding {
|
||||
console.log(`[EMBEDDING] Creating ${config.embeddingProvider} embedding instance...`);
|
||||
|
||||
switch (config.embeddingProvider) {
|
||||
@@ -62,7 +62,7 @@ export function createEmbeddingInstance(config: CodeContextMcpConfig): OpenAIEmb
|
||||
}
|
||||
}
|
||||
|
||||
export function logEmbeddingProviderInfo(config: CodeContextMcpConfig, embedding: OpenAIEmbedding | VoyageAIEmbedding | GeminiEmbedding | OllamaEmbedding): void {
|
||||
export function logEmbeddingProviderInfo(config: ContextMcpConfig, embedding: OpenAIEmbedding | VoyageAIEmbedding | GeminiEmbedding | OllamaEmbedding): void {
|
||||
console.log(`[EMBEDDING] ✅ Successfully initialized ${config.embeddingProvider} embedding provider`);
|
||||
console.log(`[EMBEDDING] Provider details - Model: ${config.embeddingModel}, Dimension: ${embedding.getDimension()}`);
|
||||
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import * as fs from "fs";
|
||||
import * as path from "path";
|
||||
import * as crypto from "crypto";
|
||||
import { CodeContext, COLLECTION_LIMIT_MESSAGE } from "@zilliz/claude-context-core";
|
||||
import { Context, COLLECTION_LIMIT_MESSAGE } from "@zilliz/claude-context-core";
|
||||
import { SnapshotManager } from "./snapshot.js";
|
||||
import { ensureAbsolutePath, truncateContent, trackCodebasePath } from "./utils.js";
|
||||
|
||||
export class ToolHandlers {
|
||||
private codeContext: CodeContext;
|
||||
private context: Context;
|
||||
private snapshotManager: SnapshotManager;
|
||||
private indexingStats: { indexedFiles: number; totalChunks: number } | null = null;
|
||||
private currentWorkspace: string;
|
||||
|
||||
constructor(codeContext: CodeContext, snapshotManager: SnapshotManager) {
|
||||
this.codeContext = codeContext;
|
||||
constructor(context: Context, snapshotManager: SnapshotManager) {
|
||||
this.context = context;
|
||||
this.snapshotManager = snapshotManager;
|
||||
this.currentWorkspace = process.cwd();
|
||||
console.log(`[WORKSPACE] Current workspace: ${this.currentWorkspace}`);
|
||||
@@ -33,7 +33,7 @@ export class ToolHandlers {
|
||||
console.log(`[SYNC-CLOUD] 🔄 Syncing indexed codebases from Zilliz Cloud...`);
|
||||
|
||||
// Get all collections using the interface method
|
||||
const vectorDb = this.codeContext['vectorDatabase'];
|
||||
const vectorDb = this.context['vectorDatabase'];
|
||||
|
||||
// Use the new listCollections method from the interface
|
||||
const collections = await vectorDb.listCollections();
|
||||
@@ -225,14 +225,14 @@ export class ToolHandlers {
|
||||
console.log(`[INDEX-VALIDATION] 🔍 Validating collection creation for: ${collectionName}`);
|
||||
|
||||
// Get embedding dimension for collection creation
|
||||
const embeddingProvider = this.codeContext['embedding'];
|
||||
const embeddingProvider = this.context['embedding'];
|
||||
const dimension = embeddingProvider.getDimension();
|
||||
|
||||
// If force reindex, clear existing collection first
|
||||
if (forceReindex) {
|
||||
console.log(`[INDEX-VALIDATION] 🧹 Force reindex enabled, clearing existing collection: ${collectionName}`);
|
||||
try {
|
||||
await this.codeContext['vectorDatabase'].dropCollection(collectionName);
|
||||
await this.context['vectorDatabase'].dropCollection(collectionName);
|
||||
console.log(`[INDEX-VALIDATION] ✅ Existing collection cleared: ${collectionName}`);
|
||||
} catch (dropError: any) {
|
||||
// Collection might not exist, which is fine
|
||||
@@ -241,14 +241,14 @@ export class ToolHandlers {
|
||||
}
|
||||
|
||||
// Attempt to create collection - this will throw COLLECTION_LIMIT_MESSAGE if limit reached
|
||||
await this.codeContext['vectorDatabase'].createCollection(
|
||||
await this.context['vectorDatabase'].createCollection(
|
||||
collectionName,
|
||||
dimension,
|
||||
`Code context collection: ${collectionName}`
|
||||
`Claude Context collection: ${collectionName}`
|
||||
);
|
||||
|
||||
// If creation succeeds, immediately drop the test collection
|
||||
await this.codeContext['vectorDatabase'].dropCollection(collectionName);
|
||||
await this.context['vectorDatabase'].dropCollection(collectionName);
|
||||
console.log(`[INDEX-VALIDATION] ✅ Collection creation validated successfully`);
|
||||
|
||||
} catch (validationError: any) {
|
||||
@@ -282,13 +282,13 @@ export class ToolHandlers {
|
||||
// Add custom extensions if provided
|
||||
if (customFileExtensions.length > 0) {
|
||||
console.log(`[CUSTOM-EXTENSIONS] Adding ${customFileExtensions.length} custom extensions: ${customFileExtensions.join(', ')}`);
|
||||
this.codeContext.addCustomExtensions(customFileExtensions);
|
||||
this.context.addCustomExtensions(customFileExtensions);
|
||||
}
|
||||
|
||||
// Add custom ignore patterns if provided (before loading file-based patterns)
|
||||
if (customIgnorePatterns.length > 0) {
|
||||
console.log(`[IGNORE-PATTERNS] Adding ${customIgnorePatterns.length} custom ignore patterns: ${customIgnorePatterns.join(', ')}`);
|
||||
this.codeContext.addCustomIgnorePatterns(customIgnorePatterns);
|
||||
this.context.addCustomIgnorePatterns(customIgnorePatterns);
|
||||
}
|
||||
|
||||
// Add to indexing list and save snapshot immediately
|
||||
@@ -346,8 +346,8 @@ export class ToolHandlers {
|
||||
console.log(`[BACKGROUND-INDEX] ℹ️ Force reindex mode - collection was already cleared during validation`);
|
||||
}
|
||||
|
||||
// Use the existing CodeContext instance for indexing.
|
||||
let contextForThisTask = this.codeContext;
|
||||
// Use the existing Context instance for indexing.
|
||||
let contextForThisTask = this.context;
|
||||
if (splitterType !== 'ast') {
|
||||
console.warn(`[BACKGROUND-INDEX] Non-AST splitter '${splitterType}' requested; falling back to AST splitter`);
|
||||
}
|
||||
@@ -362,21 +362,21 @@ export class ToolHandlers {
|
||||
|
||||
// Initialize file synchronizer with proper ignore patterns (including project-specific patterns)
|
||||
const { FileSynchronizer } = await import("@zilliz/claude-context-core");
|
||||
const ignorePatterns = this.codeContext['ignorePatterns'] || [];
|
||||
const ignorePatterns = this.context['ignorePatterns'] || [];
|
||||
console.log(`[BACKGROUND-INDEX] Using ignore patterns: ${ignorePatterns.join(', ')}`);
|
||||
const synchronizer = new FileSynchronizer(absolutePath, ignorePatterns);
|
||||
await synchronizer.initialize();
|
||||
|
||||
// Store synchronizer in the context's internal map
|
||||
this.codeContext['synchronizers'].set(collectionName, synchronizer);
|
||||
if (contextForThisTask !== this.codeContext) {
|
||||
this.context['synchronizers'].set(collectionName, synchronizer);
|
||||
if (contextForThisTask !== this.context) {
|
||||
contextForThisTask['synchronizers'].set(collectionName, synchronizer);
|
||||
}
|
||||
|
||||
console.log(`[BACKGROUND-INDEX] Starting indexing with ${splitterType} splitter for: ${absolutePath}`);
|
||||
|
||||
// Log embedding provider information before indexing
|
||||
const embeddingProvider = this.codeContext['embedding'];
|
||||
const embeddingProvider = this.context['embedding'];
|
||||
console.log(`[BACKGROUND-INDEX] 🧠 Using embedding provider: ${embeddingProvider.getProvider()} with dimension: ${embeddingProvider.getDimension()}`);
|
||||
|
||||
// Start indexing with the appropriate context
|
||||
@@ -470,12 +470,12 @@ export class ToolHandlers {
|
||||
console.log(`[SEARCH] Indexing status: ${isIndexing ? 'In Progress' : 'Completed'}`);
|
||||
|
||||
// Log embedding provider information before search
|
||||
const embeddingProvider = this.codeContext['embedding'];
|
||||
const embeddingProvider = this.context['embedding'];
|
||||
console.log(`[SEARCH] 🧠 Using embedding provider: ${embeddingProvider.getProvider()} for semantic search`);
|
||||
console.log(`[SEARCH] 🔍 Generating embeddings for query using ${embeddingProvider.getProvider()}...`);
|
||||
|
||||
// Search in the specified codebase
|
||||
const searchResults = await this.codeContext.semanticSearch(
|
||||
const searchResults = await this.context.semanticSearch(
|
||||
absolutePath,
|
||||
query,
|
||||
Math.min(resultLimit, 50),
|
||||
@@ -603,7 +603,7 @@ export class ToolHandlers {
|
||||
console.log(`[CLEAR] Clearing codebase: ${absolutePath}`);
|
||||
|
||||
try {
|
||||
await this.codeContext.clearIndex(absolutePath);
|
||||
await this.context.clearIndex(absolutePath);
|
||||
console.log(`[CLEAR] Successfully cleared index for: ${absolutePath}`);
|
||||
} catch (error: any) {
|
||||
const errorMsg = `Failed to clear ${absolutePath}: ${error.message}`;
|
||||
|
||||
@@ -21,24 +21,24 @@ import {
|
||||
ListToolsRequestSchema,
|
||||
CallToolRequestSchema
|
||||
} from "@modelcontextprotocol/sdk/types.js";
|
||||
import { CodeContext } from "@zilliz/claude-context-core";
|
||||
import { Context } from "@zilliz/claude-context-core";
|
||||
import { MilvusVectorDatabase } from "@zilliz/claude-context-core";
|
||||
|
||||
// Import our modular components
|
||||
import { createMcpConfig, logConfigurationSummary, showHelpMessage, CodeContextMcpConfig } from "./config.js";
|
||||
import { createMcpConfig, logConfigurationSummary, showHelpMessage, ContextMcpConfig } from "./config.js";
|
||||
import { createEmbeddingInstance, logEmbeddingProviderInfo } from "./embedding.js";
|
||||
import { SnapshotManager } from "./snapshot.js";
|
||||
import { SyncManager } from "./sync.js";
|
||||
import { ToolHandlers } from "./handlers.js";
|
||||
|
||||
class CodeContextMcpServer {
|
||||
class ContextMcpServer {
|
||||
private server: Server;
|
||||
private codeContext: CodeContext;
|
||||
private context: Context;
|
||||
private snapshotManager: SnapshotManager;
|
||||
private syncManager: SyncManager;
|
||||
private toolHandlers: ToolHandlers;
|
||||
|
||||
constructor(config: CodeContextMcpConfig) {
|
||||
constructor(config: ContextMcpConfig) {
|
||||
// Initialize MCP server
|
||||
this.server = new Server(
|
||||
{
|
||||
@@ -65,16 +65,16 @@ class CodeContextMcpServer {
|
||||
...(config.milvusToken && { token: config.milvusToken })
|
||||
});
|
||||
|
||||
// Initialize code context
|
||||
this.codeContext = new CodeContext({
|
||||
// Initialize Claude Context
|
||||
this.context = new Context({
|
||||
embedding,
|
||||
vectorDatabase
|
||||
});
|
||||
|
||||
// Initialize managers
|
||||
this.snapshotManager = new SnapshotManager();
|
||||
this.syncManager = new SyncManager(this.codeContext, this.snapshotManager);
|
||||
this.toolHandlers = new ToolHandlers(this.codeContext, this.snapshotManager);
|
||||
this.syncManager = new SyncManager(this.context, this.snapshotManager);
|
||||
this.toolHandlers = new ToolHandlers(this.context, this.snapshotManager);
|
||||
|
||||
// Load existing codebase snapshot on startup
|
||||
this.snapshotManager.loadCodebaseSnapshot();
|
||||
@@ -221,7 +221,7 @@ Search the indexed codebase using natural language queries within a specified ab
|
||||
|
||||
async start() {
|
||||
console.log('[SYNC-DEBUG] MCP server start() method called');
|
||||
console.log('Starting CodeContext MCP server...');
|
||||
console.log('Starting Context MCP server...');
|
||||
|
||||
const transport = new StdioServerTransport();
|
||||
console.log('[SYNC-DEBUG] StdioServerTransport created, attempting server connection...');
|
||||
@@ -252,7 +252,7 @@ async function main() {
|
||||
const config = createMcpConfig();
|
||||
logConfigurationSummary(config);
|
||||
|
||||
const server = new CodeContextMcpServer(config);
|
||||
const server = new ContextMcpServer(config);
|
||||
await server.start();
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ export class SnapshotManager {
|
||||
|
||||
constructor() {
|
||||
// Initialize snapshot file path
|
||||
this.snapshotFilePath = path.join(os.homedir(), '.codecontext', 'mcp-codebase-snapshot.json');
|
||||
this.snapshotFilePath = path.join(os.homedir(), '.context', 'mcp-codebase-snapshot.json');
|
||||
}
|
||||
|
||||
public getIndexedCodebases(): string[] {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import * as fs from "fs";
|
||||
import { CodeContext } from "@zilliz/claude-context-core";
|
||||
import { Context } from "@zilliz/claude-context-core";
|
||||
import { SnapshotManager } from "./snapshot.js";
|
||||
|
||||
export class SyncManager {
|
||||
private codeContext: CodeContext;
|
||||
private context: Context;
|
||||
private snapshotManager: SnapshotManager;
|
||||
private isSyncing: boolean = false;
|
||||
|
||||
constructor(codeContext: CodeContext, snapshotManager: SnapshotManager) {
|
||||
this.codeContext = codeContext;
|
||||
constructor(context: Context, snapshotManager: SnapshotManager) {
|
||||
this.context = context;
|
||||
this.snapshotManager = snapshotManager;
|
||||
}
|
||||
|
||||
@@ -57,8 +57,8 @@ export class SyncManager {
|
||||
}
|
||||
|
||||
try {
|
||||
console.log(`[SYNC-DEBUG] Calling codeContext.reindexByChange() for '${codebasePath}'`);
|
||||
const stats = await this.codeContext.reindexByChange(codebasePath);
|
||||
console.log(`[SYNC-DEBUG] Calling context.reindexByChange() for '${codebasePath}'`);
|
||||
const stats = await this.context.reindexByChange(codebasePath);
|
||||
const codebaseElapsed = Date.now() - codebaseStartTime;
|
||||
|
||||
console.log(`[SYNC-DEBUG] Reindex stats for '${codebasePath}':`, stats);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Contributing to VSCode Extension
|
||||
|
||||
Thanks for your interest in contributing to the Code Context VSCode extension!
|
||||
Thanks for your interest in contributing to the Claude Context VSCode extension!
|
||||
|
||||
> 📖 **First time contributing?** Please read the [main contributing guide](../../CONTRIBUTING.md) first for general setup and workflow.
|
||||
|
||||
@@ -60,7 +60,7 @@ Press `F5` to launch Extension Development Host
|
||||
## Extension Features
|
||||
|
||||
- Semantic code search within VSCode
|
||||
- Integration with Code Context core
|
||||
- Integration with Claude Context core
|
||||
- Progress indicators for indexing
|
||||
- Search results in sidebar
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
[](https://marketplace.visualstudio.com/items?itemName=zilliz.semanticcodesearch)
|
||||
|
||||
A code indexing and semantic search VSCode extension powered by [Code Context](https://github.com/zilliztech/claude-context).
|
||||
A code indexing and semantic search VSCode extension powered by [Claude Context](https://github.com/zilliztech/claude-context).
|
||||
|
||||
> 📖 **New to Code Context?** Check out the [main project README](https://github.com/zilliztech/claude-context/blob/master/README.md) for an overview and setup instructions.
|
||||
> 📖 **New to Claude Context?** Check out the [main project README](https://github.com/zilliztech/claude-context/blob/master/README.md) for an overview and setup instructions.
|
||||
|
||||
|
||||

|
||||
@@ -35,7 +35,7 @@ A code indexing and semantic search VSCode extension powered by [Code Context](h
|
||||
## Quick Start
|
||||
|
||||
### Configuration
|
||||
The first time you open Code Context, you need to click on Settings icon to configure the relevant options.
|
||||
The first time you open Claude Context, you need to click on Settings icon to configure the relevant options.
|
||||
|
||||
#### Embedding Configuration
|
||||
Configure your embedding provider to convert code into semantic vectors.
|
||||
@@ -65,7 +65,7 @@ Configure how your code is split into chunks for indexing.
|
||||
#### Zilliz Cloud configuration
|
||||
Get a free Milvus vector database on Zilliz Cloud.
|
||||
|
||||
Code Context needs a vector database. You can [sign up](https://cloud.zilliz.com/signup?utm_source=github&utm_medium=referral&utm_campaign=2507-codecontext-readme) on Zilliz Cloud to get a free Serverless cluster.
|
||||
Claude Context needs a vector database. You can [sign up](https://cloud.zilliz.com/signup?utm_source=github&utm_medium=referral&utm_campaign=2507-codecontext-readme) on Zilliz Cloud to get a free Serverless cluster.
|
||||
|
||||

|
||||
|
||||
@@ -114,7 +114,7 @@ MILVUS_TOKEN=your-zilliz-cloud-api-key
|
||||
|
||||
## Contributing
|
||||
|
||||
This VSCode extension is part of the Code Context monorepo. Please see:
|
||||
This VSCode extension is part of the Claude Context monorepo. Please see:
|
||||
- [Main Contributing Guide](https://github.com/zilliztech/claude-context/blob/master/CONTRIBUTING.md) - General contribution guidelines
|
||||
- [VSCode Extension Contributing](https://github.com/zilliztech/claude-context/blob/master/packages/vscode-extension/CONTRIBUTING.md) - Specific development guide for this extension
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "semanticcodesearch",
|
||||
"displayName": "Semantic Code Search",
|
||||
"publisher": "zilliz",
|
||||
"description": "Code indexing and semantic search (built by Code Context)",
|
||||
"description": "Code indexing and semantic search (built by Claude Context)",
|
||||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"engines": {
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
import * as vscode from 'vscode';
|
||||
import { CodeContext } from '@zilliz/claude-context-core';
|
||||
import { Context } from '@zilliz/claude-context-core';
|
||||
import * as path from 'path';
|
||||
import * as crypto from 'crypto';
|
||||
|
||||
export class IndexCommand {
|
||||
private codeContext: CodeContext;
|
||||
private context: Context;
|
||||
|
||||
constructor(codeContext: CodeContext) {
|
||||
this.codeContext = codeContext;
|
||||
constructor(context: Context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the CodeContext instance (used when configuration changes)
|
||||
* Update the Context instance (used when configuration changes)
|
||||
*/
|
||||
updateCodeContext(codeContext: CodeContext): void {
|
||||
this.codeContext = codeContext;
|
||||
updateContext(context: Context): void {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
async execute(): Promise<void> {
|
||||
@@ -65,7 +65,7 @@ export class IndexCommand {
|
||||
let lastPercentage = 0;
|
||||
|
||||
// Clear existing index first
|
||||
await this.codeContext.clearIndex(
|
||||
await this.context.clearIndex(
|
||||
selectedFolder.uri.fsPath,
|
||||
(progressInfo) => {
|
||||
// Clear index progress is usually fast, just show the message
|
||||
@@ -76,16 +76,16 @@ export class IndexCommand {
|
||||
// Initialize file synchronizer
|
||||
progress.report({ increment: 0, message: 'Initializing file synchronizer...' });
|
||||
const { FileSynchronizer } = await import("@zilliz/claude-context-core");
|
||||
const synchronizer = new FileSynchronizer(selectedFolder.uri.fsPath, this.codeContext['ignorePatterns'] || []);
|
||||
const synchronizer = new FileSynchronizer(selectedFolder.uri.fsPath, this.context['ignorePatterns'] || []);
|
||||
await synchronizer.initialize();
|
||||
// Store synchronizer in the context's internal map using the same collection name generation logic
|
||||
const normalizedPath = path.resolve(selectedFolder.uri.fsPath);
|
||||
const hash = crypto.createHash('md5').update(normalizedPath).digest('hex');
|
||||
const collectionName = `code_chunks_${hash.substring(0, 8)}`;
|
||||
this.codeContext['synchronizers'].set(collectionName, synchronizer);
|
||||
this.context['synchronizers'].set(collectionName, synchronizer);
|
||||
|
||||
// Start indexing with progress callback
|
||||
indexStats = await this.codeContext.indexCodebase(
|
||||
indexStats = await this.context.indexCodebase(
|
||||
selectedFolder.uri.fsPath,
|
||||
(progressInfo) => {
|
||||
// Calculate increment from last reported percentage
|
||||
@@ -156,7 +156,7 @@ export class IndexCommand {
|
||||
title: 'Clearing Index',
|
||||
cancellable: false
|
||||
}, async (progress) => {
|
||||
await this.codeContext.clearIndex(
|
||||
await this.context.clearIndex(
|
||||
workspaceFolders[0].uri.fsPath,
|
||||
(progressInfo) => {
|
||||
progress.report({
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
import * as vscode from 'vscode';
|
||||
import { CodeContext, SearchQuery, SemanticSearchResult } from '@zilliz/claude-context-core';
|
||||
import { Context, SearchQuery, SemanticSearchResult } from '@zilliz/claude-context-core';
|
||||
import * as path from 'path';
|
||||
|
||||
export class SearchCommand {
|
||||
private codeContext: CodeContext;
|
||||
private context: Context;
|
||||
|
||||
constructor(codeContext: CodeContext) {
|
||||
this.codeContext = codeContext;
|
||||
constructor(context: Context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the CodeContext instance (used when configuration changes)
|
||||
* Update the Context instance (used when configuration changes)
|
||||
*/
|
||||
updateCodeContext(codeContext: CodeContext): void {
|
||||
this.codeContext = codeContext;
|
||||
updateContext(context: Context): void {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
async execute(preSelectedText?: string): Promise<void> {
|
||||
@@ -59,7 +59,7 @@ export class SearchCommand {
|
||||
limit: 20
|
||||
};
|
||||
|
||||
const results = await this.codeContext.semanticSearch(
|
||||
const results = await this.context.semanticSearch(
|
||||
codebasePath,
|
||||
query.term,
|
||||
query.limit || 20,
|
||||
@@ -136,7 +136,7 @@ export class SearchCommand {
|
||||
const codebasePath = workspaceFolders[0].uri.fsPath;
|
||||
|
||||
// Use the semantic search service
|
||||
return await this.codeContext.semanticSearch(
|
||||
return await this.context.semanticSearch(
|
||||
codebasePath,
|
||||
searchTerm,
|
||||
limit,
|
||||
@@ -148,7 +148,7 @@ export class SearchCommand {
|
||||
* Check if index exists for the given codebase path
|
||||
*/
|
||||
async hasIndex(codebasePath: string): Promise<boolean> {
|
||||
return await this.codeContext.hasIndex(codebasePath);
|
||||
return await this.context.hasIndex(codebasePath);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
import * as vscode from 'vscode';
|
||||
import { CodeContext } from '@zilliz/claude-context-core';
|
||||
import { Context } from '@zilliz/claude-context-core';
|
||||
import * as fs from 'fs';
|
||||
|
||||
export class SyncCommand {
|
||||
private codeContext: CodeContext;
|
||||
private context: Context;
|
||||
private isSyncing: boolean = false;
|
||||
|
||||
constructor(codeContext: CodeContext) {
|
||||
this.codeContext = codeContext;
|
||||
constructor(context: Context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the CodeContext instance (used when configuration changes)
|
||||
* Update the Context instance (used when configuration changes)
|
||||
*/
|
||||
updateCodeContext(codeContext: CodeContext): void {
|
||||
this.codeContext = codeContext;
|
||||
updateContext(context: Context): void {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,7 +57,7 @@ export class SyncCommand {
|
||||
progress.report({ increment: 0, message: 'Checking for file changes...' });
|
||||
|
||||
try {
|
||||
syncStats = await this.codeContext.reindexByChange(
|
||||
syncStats = await this.context.reindexByChange(
|
||||
codebasePath,
|
||||
(progressInfo) => {
|
||||
const increment = progressInfo.percentage;
|
||||
@@ -148,7 +148,7 @@ export class SyncCommand {
|
||||
this.isSyncing = true;
|
||||
|
||||
try {
|
||||
const syncStats = await this.codeContext.reindexByChange(codebasePath);
|
||||
const syncStats = await this.context.reindexByChange(codebasePath);
|
||||
|
||||
const totalChanges = syncStats.added + syncStats.removed + syncStats.modified;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { SearchCommand } from './commands/searchCommand';
|
||||
import { IndexCommand } from './commands/indexCommand';
|
||||
import { SyncCommand } from './commands/syncCommand';
|
||||
import { ConfigManager } from './config/configManager';
|
||||
import { CodeContext, OpenAIEmbedding, VoyageAIEmbedding, GeminiEmbedding, MilvusRestfulVectorDatabase, AstCodeSplitter, LangChainCodeSplitter, SplitterType } from '@zilliz/claude-context-core';
|
||||
import { Context, OpenAIEmbedding, VoyageAIEmbedding, GeminiEmbedding, MilvusRestfulVectorDatabase, AstCodeSplitter, LangChainCodeSplitter, SplitterType } from '@zilliz/claude-context-core';
|
||||
import { envManager } from '@zilliz/claude-context-core';
|
||||
|
||||
let semanticSearchProvider: SemanticSearchViewProvider;
|
||||
@@ -13,17 +13,17 @@ let searchCommand: SearchCommand;
|
||||
let indexCommand: IndexCommand;
|
||||
let syncCommand: SyncCommand;
|
||||
let configManager: ConfigManager;
|
||||
let codeContext: CodeContext;
|
||||
let codeContext: Context;
|
||||
let autoSyncDisposable: vscode.Disposable | null = null;
|
||||
|
||||
export async function activate(context: vscode.ExtensionContext) {
|
||||
console.log('CodeContext extension is now active!');
|
||||
console.log('Context extension is now active!');
|
||||
|
||||
// Initialize config manager
|
||||
configManager = new ConfigManager(context);
|
||||
|
||||
// Initialize shared codeContext instance with embedding configuration
|
||||
codeContext = createCodeContextWithConfig(configManager);
|
||||
// Initialize shared context instance with embedding configuration
|
||||
codeContext = createContextWithConfig(configManager);
|
||||
|
||||
// Initialize providers and commands
|
||||
searchCommand = new SearchCommand(codeContext);
|
||||
@@ -46,8 +46,8 @@ export async function activate(context: vscode.ExtensionContext) {
|
||||
event.affectsConfiguration('semanticCodeSearch.milvus') ||
|
||||
event.affectsConfiguration('semanticCodeSearch.splitter') ||
|
||||
event.affectsConfiguration('semanticCodeSearch.autoSync')) {
|
||||
console.log('CodeContext configuration changed, reloading...');
|
||||
reloadCodeContextConfiguration();
|
||||
console.log('Context configuration changed, reloading...');
|
||||
reloadContextConfiguration();
|
||||
}
|
||||
}),
|
||||
|
||||
@@ -60,7 +60,7 @@ export async function activate(context: vscode.ExtensionContext) {
|
||||
}),
|
||||
vscode.commands.registerCommand('semanticCodeSearch.indexCodebase', () => indexCommand.execute()),
|
||||
vscode.commands.registerCommand('semanticCodeSearch.clearIndex', () => indexCommand.clearIndex()),
|
||||
vscode.commands.registerCommand('semanticCodeSearch.reloadConfiguration', () => reloadCodeContextConfiguration())
|
||||
vscode.commands.registerCommand('semanticCodeSearch.reloadConfiguration', () => reloadContextConfiguration())
|
||||
];
|
||||
|
||||
context.subscriptions.push(...disposables);
|
||||
@@ -73,7 +73,7 @@ export async function activate(context: vscode.ExtensionContext) {
|
||||
|
||||
// Show status bar item
|
||||
const statusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, 100);
|
||||
statusBarItem.text = `$(search) CodeContext`;
|
||||
statusBarItem.text = `$(search) Context`;
|
||||
statusBarItem.tooltip = 'Click to open semantic search';
|
||||
statusBarItem.command = 'semanticCodeSearch.semanticSearch';
|
||||
statusBarItem.show();
|
||||
@@ -118,7 +118,7 @@ function setupAutoSync() {
|
||||
}
|
||||
}
|
||||
|
||||
function createCodeContextWithConfig(configManager: ConfigManager): CodeContext {
|
||||
function createContextWithConfig(configManager: ConfigManager): Context {
|
||||
const embeddingConfig = configManager.getEmbeddingProviderConfig();
|
||||
const milvusConfig = configManager.getMilvusFullConfig();
|
||||
const splitterConfig = configManager.getSplitterConfig();
|
||||
@@ -127,13 +127,13 @@ function createCodeContextWithConfig(configManager: ConfigManager): CodeContext
|
||||
let embedding;
|
||||
let vectorDatabase;
|
||||
|
||||
const codeContextConfig: any = {};
|
||||
const contextConfig: any = {};
|
||||
|
||||
// Create embedding instance
|
||||
if (embeddingConfig) {
|
||||
embedding = ConfigManager.createEmbeddingInstance(embeddingConfig.provider, embeddingConfig.config);
|
||||
console.log(`Embedding initialized with ${embeddingConfig.provider} (model: ${embeddingConfig.config.model})`);
|
||||
codeContextConfig.embedding = embedding;
|
||||
contextConfig.embedding = embedding;
|
||||
} else {
|
||||
console.log('No embedding configuration found');
|
||||
}
|
||||
@@ -142,14 +142,14 @@ function createCodeContextWithConfig(configManager: ConfigManager): CodeContext
|
||||
if (milvusConfig) {
|
||||
vectorDatabase = new MilvusRestfulVectorDatabase(milvusConfig);
|
||||
console.log(`Vector database initialized with Milvus REST API (address: ${milvusConfig.address})`);
|
||||
codeContextConfig.vectorDatabase = vectorDatabase;
|
||||
contextConfig.vectorDatabase = vectorDatabase;
|
||||
} else {
|
||||
vectorDatabase = new MilvusRestfulVectorDatabase({
|
||||
address: envManager.get('MILVUS_ADDRESS') || 'http://localhost:19530',
|
||||
token: envManager.get('MILVUS_TOKEN') || ''
|
||||
});
|
||||
console.log('No Milvus configuration found, using default REST API configuration');
|
||||
codeContextConfig.vectorDatabase = vectorDatabase;
|
||||
contextConfig.vectorDatabase = vectorDatabase;
|
||||
}
|
||||
|
||||
// Create splitter instance
|
||||
@@ -166,23 +166,23 @@ function createCodeContextWithConfig(configManager: ConfigManager): CodeContext
|
||||
splitterConfig.chunkOverlap ?? 300
|
||||
);
|
||||
}
|
||||
codeContextConfig.codeSplitter = codeSplitter;
|
||||
contextConfig.codeSplitter = codeSplitter;
|
||||
console.log(`Splitter configured: ${splitterConfig.type} (chunkSize: ${splitterConfig.chunkSize}, overlap: ${splitterConfig.chunkOverlap})`);
|
||||
} else {
|
||||
codeSplitter = new AstCodeSplitter(2500, 300);
|
||||
codeContextConfig.codeSplitter = codeSplitter;
|
||||
contextConfig.codeSplitter = codeSplitter;
|
||||
console.log('No splitter configuration found, using default AST splitter (chunkSize: 2500, overlap: 300)');
|
||||
}
|
||||
return new CodeContext(codeContextConfig);
|
||||
return new Context(contextConfig);
|
||||
} catch (error) {
|
||||
console.error('Failed to create CodeContext with user config:', error);
|
||||
vscode.window.showErrorMessage(`Failed to initialize CodeContext: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
||||
console.error('Failed to create Context with user config:', error);
|
||||
vscode.window.showErrorMessage(`Failed to initialize Context: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
function reloadCodeContextConfiguration() {
|
||||
console.log('Reloading CodeContext configuration...');
|
||||
function reloadContextConfiguration() {
|
||||
console.log('Reloading Context configuration...');
|
||||
|
||||
const embeddingConfig = configManager.getEmbeddingProviderConfig();
|
||||
const milvusConfig = configManager.getMilvusFullConfig();
|
||||
@@ -225,24 +225,24 @@ function reloadCodeContextConfiguration() {
|
||||
console.log('No splitter configuration found, using default AST splitter (chunkSize: 2500, overlap: 300)');
|
||||
}
|
||||
|
||||
// Update command instances with new codeContext
|
||||
searchCommand.updateCodeContext(codeContext);
|
||||
indexCommand.updateCodeContext(codeContext);
|
||||
syncCommand.updateCodeContext(codeContext);
|
||||
// Update command instances with new context
|
||||
searchCommand.updateContext(codeContext);
|
||||
indexCommand.updateContext(codeContext);
|
||||
syncCommand.updateContext(codeContext);
|
||||
|
||||
// Restart auto-sync if it was enabled
|
||||
setupAutoSync();
|
||||
|
||||
console.log('CodeContext configuration reloaded successfully');
|
||||
console.log('Context configuration reloaded successfully');
|
||||
vscode.window.showInformationMessage('Configuration reloaded successfully!');
|
||||
} catch (error) {
|
||||
console.error('Failed to reload CodeContext configuration:', error);
|
||||
console.error('Failed to reload Context configuration:', error);
|
||||
vscode.window.showErrorMessage(`Failed to reload configuration: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
||||
}
|
||||
}
|
||||
|
||||
export function deactivate() {
|
||||
console.log('CodeContext extension is now deactivated');
|
||||
console.log('Context extension is now deactivated');
|
||||
|
||||
// Stop auto-sync if running
|
||||
if (autoSyncDisposable) {
|
||||
|
||||
@@ -259,7 +259,7 @@ export class SemanticSearchViewProvider implements vscode.WebviewViewProvider {
|
||||
// Add a small delay to ensure configuration is fully saved
|
||||
await new Promise(resolve => setTimeout(resolve, 100));
|
||||
|
||||
// Notify extension to recreate CodeContext with new config
|
||||
// Notify extension to recreate Context with new config
|
||||
vscode.commands.executeCommand('semanticCodeSearch.reloadConfiguration');
|
||||
|
||||
webview.postMessage({
|
||||
@@ -268,7 +268,7 @@ export class SemanticSearchViewProvider implements vscode.WebviewViewProvider {
|
||||
message: 'Configuration saved successfully!'
|
||||
});
|
||||
|
||||
vscode.window.showInformationMessage('CodeContext configuration saved successfully!');
|
||||
vscode.window.showInformationMessage('Context configuration saved successfully!');
|
||||
} catch (error) {
|
||||
webview.postMessage({
|
||||
command: 'saveResult',
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<div class="title-section">
|
||||
<h3>🔍 Semantic Code Search</h3>
|
||||
<p class="subtitle">built by <a href="https://github.com/zilliztech/claude-context"
|
||||
target="_blank">Code Context</a></p>
|
||||
target="_blank">Claude Context</a></p>
|
||||
</div>
|
||||
<button id="settingsButton" class="settings-button" title="Settings">
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
# Python → TypeScript Code Context Bridge
|
||||
# Python → TypeScript Claude Context Bridge
|
||||
|
||||
A simple utility to call TypeScript Code Context methods from Python.
|
||||
A simple utility to call TypeScript Claude Context methods from Python.
|
||||
|
||||
## What's This?
|
||||
|
||||
This directory contains a basic bridge that allows you to run Code Context TypeScript functions from Python scripts. It's not a full SDK - just a simple way to test and use the TypeScript codebase from Python.
|
||||
This directory contains a basic bridge that allows you to run Claude Context TypeScript functions from Python scripts. It's not a full SDK - just a simple way to test and use the TypeScript codebase from Python.
|
||||
|
||||
## Files
|
||||
|
||||
- `ts_executor.py` - Executes TypeScript methods from Python
|
||||
- `test_codecontext.ts` - TypeScript test script with Code Context workflow
|
||||
- `test_context.ts` - TypeScript test script with Claude Context workflow
|
||||
- `test_endtoend.py` - Python script that calls the TypeScript test
|
||||
|
||||
## Prerequisites
|
||||
@@ -46,8 +46,8 @@ from ts_executor import TypeScriptExecutor
|
||||
|
||||
executor = TypeScriptExecutor()
|
||||
result = executor.call_method(
|
||||
'./test_codecontext.ts',
|
||||
'testCodeContextEndToEnd',
|
||||
'./test_context.ts',
|
||||
'testContextEndToEnd',
|
||||
{
|
||||
'openaiApiKey': 'sk-your-key',
|
||||
'milvusAddress': 'localhost:19530',
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
import { CodeContext } from '../packages/core/src/context';
|
||||
import { Context } from '../packages/core/src/context';
|
||||
import { OpenAIEmbedding } from '../packages/core/src/embedding/openai-embedding';
|
||||
import { MilvusVectorDatabase } from '../packages/core/src/vectordb/milvus-vectordb';
|
||||
import { AstCodeSplitter } from '../packages/core/src/splitter/ast-splitter';
|
||||
|
||||
/**
|
||||
* CodeContext End-to-End Test - Complete Workflow
|
||||
* Context End-to-End Test - Complete Workflow
|
||||
* Includes: Configure Embedding → Configure Vector Database → Create Context → Index Codebase → Semantic Search
|
||||
*/
|
||||
export async function testCodeContextEndToEnd(config: {
|
||||
export async function testContextEndToEnd(config: {
|
||||
openaiApiKey: string;
|
||||
milvusAddress: string;
|
||||
codebasePath: string;
|
||||
searchQuery: string;
|
||||
}) {
|
||||
try {
|
||||
console.log('🚀 Starting CodeContext end-to-end test...');
|
||||
console.log('🚀 Starting Context end-to-end test...');
|
||||
|
||||
// 1. Create embedding instance
|
||||
console.log('📝 Creating OpenAI embedding instance...');
|
||||
@@ -29,10 +29,10 @@ export async function testCodeContextEndToEnd(config: {
|
||||
address: config.milvusAddress
|
||||
});
|
||||
|
||||
// 3. Create CodeContext instance
|
||||
console.log('🔧 Creating CodeContext instance...');
|
||||
// 3. Create Context instance
|
||||
console.log('🔧 Creating Context instance...');
|
||||
const codeSplitter = new AstCodeSplitter(1000, 200);
|
||||
const context = new CodeContext({
|
||||
const context = new Context({
|
||||
embedding: embedding,
|
||||
vectorDatabase: vectorDB,
|
||||
codeSplitter: codeSplitter
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
CodeContext End-to-End Test
|
||||
Use TypeScriptExecutor to call complete CodeContext workflow
|
||||
Claude Context End-to-End Test
|
||||
Use TypeScriptExecutor to call complete Claude Context workflow
|
||||
"""
|
||||
|
||||
import os
|
||||
@@ -14,8 +14,8 @@ sys.path.append(str(Path(__file__).parent))
|
||||
from ts_executor import TypeScriptExecutor
|
||||
|
||||
|
||||
def run_codecontext_endtoend_test():
|
||||
"""Run CodeContext end-to-end test"""
|
||||
def run_context_endtoend_test():
|
||||
"""Run Claude Context end-to-end test"""
|
||||
|
||||
# Configuration parameters
|
||||
config = {
|
||||
@@ -27,7 +27,7 @@ def run_codecontext_endtoend_test():
|
||||
"searchQuery": "embedding creation and vector database configuration",
|
||||
}
|
||||
|
||||
print("🚀 Starting CodeContext end-to-end test")
|
||||
print("🚀 Starting Claude Context end-to-end test")
|
||||
print(f"📊 Configuration:")
|
||||
print(f" - Codebase path: {config['codebasePath']}")
|
||||
print(f" - Vector database: {config['milvusAddress']}")
|
||||
@@ -42,7 +42,7 @@ def run_codecontext_endtoend_test():
|
||||
|
||||
# Call end-to-end test
|
||||
result = executor.call_method(
|
||||
"./test_codecontext.ts", "testCodeContextEndToEnd", config
|
||||
"./test_context.ts", "testContextEndToEnd", config
|
||||
)
|
||||
|
||||
# Output results
|
||||
@@ -104,19 +104,19 @@ def run_codecontext_endtoend_test():
|
||||
def main():
|
||||
"""Main function"""
|
||||
print("=" * 60)
|
||||
print("🧪 CodeContext End-to-End Test")
|
||||
print("🧪 Claude Context End-to-End Test")
|
||||
print("=" * 60)
|
||||
print()
|
||||
|
||||
success = run_codecontext_endtoend_test()
|
||||
success = run_context_endtoend_test()
|
||||
|
||||
print()
|
||||
print("=" * 60)
|
||||
if success:
|
||||
print("🎉 Test completed! CodeContext end-to-end workflow runs successfully!")
|
||||
print("🎉 Test completed! Claude Context end-to-end workflow runs successfully!")
|
||||
print()
|
||||
print("💡 This proves:")
|
||||
print(" ✅ Can call TypeScript CodeContext from Python")
|
||||
print(" ✅ Can call TypeScript Claude Context from Python")
|
||||
print(" ✅ Supports complete indexing and search workflow")
|
||||
print(" ✅ Supports complex configuration and parameter passing")
|
||||
print(" ✅ Can get detailed execution results and statistics")
|
||||
|
||||
Reference in New Issue
Block a user