mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-10 02:24:35 +08:00
refactor: Simplify pycli installation to use PATH environment variable
- Modify install_pycli.sh to add ~/.claude/scripts/ to PATH instead of creating alias - Remove redundant alias configuration, use direct PATH registration - Update documentation to reflect simplified installation process - Delete README.md as requested by user - Now users can call 'pycli' directly after installation without alias setup Installation process: 1. Run install_pycli.sh 2. Reload shell configuration (source ~/.bashrc) 3. Use 'pycli' command directly 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,152 +0,0 @@
|
||||
# pycli - Python CLI Wrapper with Hierarchical Vector Database
|
||||
|
||||
This directory contains the bash wrapper and configuration for the enhanced Python-based analysis CLI with hierarchical vector database support.
|
||||
|
||||
## 📁 Files
|
||||
|
||||
- **`pycli`** - Main bash wrapper script
|
||||
- **`pycli.conf`** - Configuration file
|
||||
- **`install_pycli.sh`** - Installation script
|
||||
- **`README.md`** - This documentation
|
||||
|
||||
## 🚀 Quick Installation
|
||||
|
||||
```bash
|
||||
# Run the installation script
|
||||
bash install_pycli.sh
|
||||
|
||||
# Follow the prompts to configure your shell
|
||||
# The script will automatically detect your Python installation
|
||||
|
||||
# Verify installation
|
||||
pycli --help
|
||||
```
|
||||
|
||||
## 🎯 Key Features
|
||||
|
||||
### Hierarchical Vector Database
|
||||
- **Smart Parent Discovery**: Subdirectories automatically use parent's vector database
|
||||
- **No Redundant Processing**: Avoids duplicate vectorization in project subdirectories
|
||||
- **Central Storage**: All vector databases stored in `~/.claude/vector_db/`
|
||||
- **Path-based Organization**: Organized by project directory structure
|
||||
|
||||
### Unified Interface
|
||||
- **Single Command**: `pycli` replaces complex Python script calls
|
||||
- **Intelligent Context**: Automatic file discovery with semantic search
|
||||
- **Tool Integration**: Seamless integration with Gemini and Codex
|
||||
- **Configuration Management**: Environment-specific Python interpreter paths
|
||||
|
||||
## 📋 Common Commands
|
||||
|
||||
```bash
|
||||
# Initialize new project
|
||||
cd /path/to/your/project
|
||||
pycli --init
|
||||
|
||||
# Smart analysis
|
||||
pycli --analyze --query "authentication patterns" --tool gemini
|
||||
|
||||
# Direct analysis
|
||||
pycli --analyze --tool codex -p "implement user login"
|
||||
|
||||
# Maintenance
|
||||
pycli --update-embeddings
|
||||
pycli --status
|
||||
```
|
||||
|
||||
## 🔧 Configuration
|
||||
|
||||
Edit `~/.claude/scripts/pycli.conf` after installation:
|
||||
|
||||
```bash
|
||||
# Python interpreter path
|
||||
PYTHON_PATH="/usr/bin/python3"
|
||||
|
||||
# Vector database root directory
|
||||
VECTOR_DB_ROOT="$HOME/.claude/vector_db"
|
||||
|
||||
# Python scripts directory
|
||||
PYTHON_SCRIPT_DIR="$HOME/.claude/python_script"
|
||||
```
|
||||
|
||||
## 🏗️ How Hierarchical DB Works
|
||||
|
||||
```
|
||||
Project Structure: Vector Database:
|
||||
/home/user/myproject/ ~/.claude/vector_db/
|
||||
├── src/ └── home_user_myproject/
|
||||
│ ├── auth/ ├── embeddings.pkl
|
||||
│ └── api/ └── index.json
|
||||
└── tests/
|
||||
|
||||
# All subdirectories use the single parent DB
|
||||
```
|
||||
|
||||
## 📖 Documentation
|
||||
|
||||
For complete usage information, see:
|
||||
- **Strategy Guide**: `~/.claude/workflows/python-tools-strategy.md`
|
||||
- **Installation Guide**: Run `bash install_pycli.sh` for guided setup
|
||||
|
||||
## 🎪 Migration from Legacy Tools
|
||||
|
||||
```bash
|
||||
# Replace gemini-wrapper
|
||||
# OLD: ~/.claude/scripts/gemini-wrapper -p "prompt"
|
||||
# NEW: pycli --analyze --tool gemini -p "prompt"
|
||||
|
||||
# Replace codex commands
|
||||
# OLD: codex --full-auto exec "task"
|
||||
# NEW: pycli --analyze --tool codex -p "task"
|
||||
|
||||
# Enhanced with context discovery
|
||||
pycli --analyze --query "relevant context" --tool both
|
||||
```
|
||||
|
||||
## 🐛 Troubleshooting
|
||||
|
||||
```bash
|
||||
# Check system status
|
||||
pycli --status
|
||||
|
||||
# Rebuild everything
|
||||
pycli --init
|
||||
|
||||
# Test search functionality
|
||||
pycli --test-search
|
||||
|
||||
# View configuration
|
||||
cat ~/.claude/scripts/pycli.conf
|
||||
```
|
||||
|
||||
## 💡 Advanced Usage
|
||||
|
||||
### Project Integration
|
||||
```bash
|
||||
# Add to package.json
|
||||
{
|
||||
"scripts": {
|
||||
"analyze": "pycli --analyze --query",
|
||||
"ai-init": "pycli --init",
|
||||
"ai-update": "pycli --update-embeddings"
|
||||
}
|
||||
}
|
||||
|
||||
# Use in Makefiles
|
||||
analyze:
|
||||
pycli --analyze --query "$(QUERY)" --tool gemini
|
||||
```
|
||||
|
||||
### CI/CD Integration
|
||||
```yaml
|
||||
# GitHub Actions example
|
||||
- name: Update AI Context
|
||||
run: pycli --update-embeddings
|
||||
|
||||
- name: Analyze Changes
|
||||
run: pycli --analyze --query "code review" --tool gemini
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
For questions or issues, check the documentation or run `pycli --help`.
|
||||
@@ -199,19 +199,14 @@ add_to_shell_config() {
|
||||
return 1
|
||||
}
|
||||
|
||||
# Try to add alias automatically
|
||||
ALIAS_ADDED=false
|
||||
# Add pycli to PATH
|
||||
PATH_ADDED=false
|
||||
|
||||
if [[ -n "$SHELL_RC" ]]; then
|
||||
# Try to add alias
|
||||
if add_to_shell_config "$SHELL_RC" "alias pycli='$INSTALL_DIR/pycli'"; then
|
||||
ALIAS_ADDED=true
|
||||
fi
|
||||
|
||||
# Also add to PATH
|
||||
# Add pycli directory to PATH
|
||||
if add_to_shell_config "$SHELL_RC" "export PATH=\"\$PATH:$INSTALL_DIR\""; then
|
||||
PATH_ADDED=true
|
||||
print_success "Added $INSTALL_DIR to PATH in $SHELL_RC"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -254,7 +249,7 @@ echo
|
||||
echo "🚀 Quick Start:"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
|
||||
if [[ "$ALIAS_ADDED" == true ]]; then
|
||||
if [[ "$PATH_ADDED" == true ]]; then
|
||||
echo " 1. Reload your shell configuration:"
|
||||
echo " source $SHELL_RC"
|
||||
echo
|
||||
@@ -265,16 +260,12 @@ if [[ "$ALIAS_ADDED" == true ]]; then
|
||||
echo " 3. Start analyzing code:"
|
||||
echo " pycli --analyze --query \"authentication patterns\" --tool gemini"
|
||||
else
|
||||
echo " 1. Add pycli to your shell configuration:"
|
||||
if [[ -n "$SHELL_RC" ]]; then
|
||||
echo " echo \"alias pycli='$INSTALL_DIR/pycli'\" >> $SHELL_RC"
|
||||
echo " source $SHELL_RC"
|
||||
else
|
||||
echo " alias pycli='$INSTALL_DIR/pycli'"
|
||||
fi
|
||||
echo " 1. Add pycli to your PATH manually:"
|
||||
echo " echo 'export PATH=\"\$PATH:$INSTALL_DIR\"' >> $SHELL_RC"
|
||||
echo " source $SHELL_RC"
|
||||
echo
|
||||
echo " 2. Or add to PATH:"
|
||||
echo " export PATH=\"\$PATH:$INSTALL_DIR\""
|
||||
echo " 2. Or create a symlink (alternative):"
|
||||
echo " sudo ln -sf $INSTALL_DIR/pycli /usr/local/bin/pycli"
|
||||
echo
|
||||
echo " 3. Initialize vector DB for a project:"
|
||||
echo " cd /path/to/your/project"
|
||||
@@ -293,10 +284,11 @@ echo
|
||||
echo "⚙️ Configuration:"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo " • Edit config: $INSTALL_DIR/pycli.conf"
|
||||
echo " • pycli location: $INSTALL_DIR/pycli"
|
||||
|
||||
if [[ -z "$DETECTED_PYTHON" ]]; then
|
||||
echo " • ⚠️ Please update PYTHON_PATH in pycli.conf"
|
||||
fi
|
||||
|
||||
echo
|
||||
print_success "Installation complete! 🎉"
|
||||
print_success "Installation complete! Now you can use 'pycli' command directly! 🎉"
|
||||
Reference in New Issue
Block a user