mirror of
				https://github.com/zilliztech/claude-context.git
				synced 2025-10-06 01:10:02 +03:00 
			
		
		
		
	Python → TypeScript Code Context Bridge
A simple utility to call TypeScript Code 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.
Files
- ts_executor.py- Executes TypeScript methods from Python
- test_codecontext.ts- TypeScript test script with Code Context workflow
- test_endtoend.py- Python script that calls the TypeScript test
Prerequisites
# Make sure you have Node.js dependencies installed
cd .. && pnpm install
# Set your OpenAI API key (required for actual indexing)
export OPENAI_API_KEY="your-openai-api-key"
# Optional: Set Milvus address (defaults to localhost:19530)
export MILVUS_ADDRESS="localhost:19530"
Quick Usage
# Run the end-to-end test
python test_endtoend.py
This will:
- Create embeddings using OpenAI
- Connect to Milvus vector database
- Index the packages/core/srccodebase
- Perform a semantic search
- Show results
Manual Usage
from ts_executor import TypeScriptExecutor
executor = TypeScriptExecutor()
result = executor.call_method(
    './test_codecontext.ts',
    'testCodeContextEndToEnd',
    {
        'openaiApiKey': 'sk-your-key',
        'milvusAddress': 'localhost:19530',
        'codebasePath': '../packages/core/src',
        'searchQuery': 'vector database configuration'
    }
)
print(result)
How It Works
- ts_executor.pycreates temporary TypeScript wrapper files
- Runs them with ts-node
- Captures JSON output and returns to Python
- Supports async functions and complex parameters
That's it! This is just a simple bridge for testing purposes.
