@claude-vector/cli
v2.6.2
Published
CLI for Claude-integrated vector search
Maintainers
Readme
@claude-vector/cli
Command-line interface for Claude-integrated vector search. Provides powerful AI-assisted development tools right from your terminal.
Features
- 🔍 Semantic Code Search: Find code using natural language queries
- 🎯 Smart Project Detection: Automatically detects project root from any directory
- 📝 Auto Environment Loading: Finds and loads .env files automatically
- 🚀 Simple Installation: Just
npm install @claude-vector/cli - 💡 Dual Command Support: Both
ccvector(simple) andclaude-search(advanced) - 🔧 Flexible Configuration: Supports multiple index directory formats
- 🔄 Dynamic Threshold Adjustment: Automatically adjusts search sensitivity for better results
- 🎸 Query Optimization: Optional abbreviation expansion for better search results
Installation
# Install in your project (recommended)
npm install @claude-vector/cli
# Or install globally
npm install -g @claude-vector/cliQuick Start
Option 1: ccvector (Simple & Recommended)
# 1. Set up your environment
echo "OPENAI_API_KEY=your-api-key" >> .env.local
# 2. Create index (if needed)
npx ccvector index
# 3. Start searching from any directory
npx ccvector search "authentication function"
cd src/components # Works from any subdirectory
npx ccvector search "user login"Option 2: claude-search (Advanced Features)
# Initialize your project
claude-search init
# Search for code
claude-search search "authentication function"
# Start an AI development session
claude-search start "implement user login"
# View session status
claude-search statusCommands
ccvector Commands (Simple & Recommended)
ccvector search
Search for code using semantic similarity.
ccvector search <query> [options]
Options:
--limit <number> Maximum number of results (default: 20)
--threshold <number> Similarity threshold 0-1 (default: 0.4)
-h, --help Display help
Examples:
ccvector search "user authentication"
ccvector search "database connection" --limit 10
ccvector search "error handling" --threshold 0.2ccvector index
Create or update the search index.
ccvector index [options]
Options:
-f, --force Force recreate existing index
-h, --help Display help
Examples:
ccvector index
ccvector index --forceccvector info
Show project and index information.
ccvector info
Examples:
ccvector infoccvector help
Show help information.
ccvector help
ccvector --help
ccvector -hclaude-search Commands (Advanced Features)
claude-search init
Initialize vector search for your project.
claude-search init [options]
Options:
-p, --project-path <path> Path to project directory (default: current directory)
-f, --force Force re-initialization
-h, --help Display helpclaude-search search
Search for code using semantic similarity.
claude-search search <query> [options]
Options:
-l, --limit <number> Maximum number of results (default: 10)
-t, --threshold <number> Similarity threshold 0-1 (default: 0.4)
-f, --format <format> Output format: json, table, detailed (default: table)
--optimize Enable query optimization (expand abbreviations)
--no-optimize Disable query optimization
--auto Automatically add results to context and optimize query
-h, --help Display help
Examples:
claude-search search "user authentication"
claude-search search "database connection" --limit 5
claude-search search "error handling" --format json
claude-search search "auth" --optimize # Expands to "auth authentication"
claude-search search "auth" --no-optimize # Searches for exact termclaude-search start
Start an AI-assisted development session.
claude-search start <task> [options]
Options:
-c, --context <items> Maximum context items (default: 20)
-t, --type <type> Session type: development, debugging, research (default: development)
-h, --help Display help
Examples:
claude-search start "implement user registration"
claude-search start "debug authentication issue" --type debuggingclaude-search status
View current session status and statistics.
claude-search status [options]
Options:
-d, --detailed Show detailed session information
-h, --help Display helpclaude-search context
Manage development context and view session information.
claude-search context [options]
Options:
-d, --detailed Show detailed context information
-a, --activities Show recent activities
-h, --help Display helpclaude-search config
View and manage configuration.
claude-search config [options]
Options:
-s, --show Show current configuration
-h, --help Display helpConfiguration
The CLI uses configuration files to customize behavior:
Global Configuration
Create ~/.claude-search.config.js:
export default {
openaiApiKey: process.env.OPENAI_API_KEY,
defaultProjectPath: '.',
search: {
threshold: 0.4, // Lowered for better results
maxResults: 10
},
session: {
maxContextItems: 20,
autoSave: true
}
};Project Configuration
Create .claude-search.config.js in your project root:
export default {
patterns: {
include: ['src/**/*.{js,ts}', 'docs/**/*.md'],
exclude: ['**/*.test.js', '**/__tests__/**', 'node_modules/**']
},
chunks: {
maxSize: 1500,
overlap: 300
},
search: {
threshold: 0.8
}
};Environment Variables
OPENAI_API_KEY: Your OpenAI API key (required)CLAUDE_SESSION_DIR: Directory for session files (default: ~/.claude-sessions)CLAUDE_CACHE_DIR: Directory for cache files (default: .claude-vector-cache)
Examples
Basic Workflow
# 1. Initialize project
cd my-project
claude-search init
# 2. Search for relevant code
claude-search search "user authentication logic"
# 3. Start development session
claude-search start "add two-factor authentication"
# 4. Check session status
claude-search status --detailedAdvanced Usage
# High-precision search
claude-search search "JWT token validation" --threshold 0.9 --limit 3
# Debugging session with detailed context
claude-search start "fix login bug" --type debugging --context 30
# Export search results
claude-search search "API endpoints" --format json > api-search.jsonAvailable Commands Summary
The CLI provides multiple command interfaces:
ccvector (Recommended for simple use)
# Simple, auto-detecting, works from any directory
npx ccvector search "function definition"
npx ccvector index
npx ccvector infoclaude-search (Full featured)
# Advanced AI-powered development
claude-search search "function definition"
claude-search start "implement feature"
claude-search statuscs (Shorthand for claude-search)
# Short alias for claude-search
cs search "function definition"
cs start "implement feature"
cs statusIntegration
VS Code Integration
Add these tasks to your .vscode/tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"label": "Claude Search",
"type": "shell",
"command": "claude-search",
"args": ["search", "${input:searchQuery}"],
"group": "build",
"presentation": {
"reveal": "always",
"panel": "new"
}
}
],
"inputs": [
{
"id": "searchQuery",
"description": "Search query",
"default": "",
"type": "promptString"
}
]
}Git Hooks
Add to .git/hooks/pre-commit:
#!/bin/sh
# Update search index before commit
claude-search init --forcePerformance
- Caching: Results are cached for faster subsequent searches
- Incremental Updates: Only changed files are reprocessed
- Batch Processing: Efficient handling of large codebases
- Memory Management: Optimized memory usage for large projects
Requirements
- Node.js 18+
- OpenAI API key
- Git repository (optional, for enhanced project analysis)
License
MIT
