mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-10 02:24:35 +08:00
feat: Update workflow architecture documentation and clean up scripts
Major updates: - Enhanced workflow lifecycle with 6-phase development process - Updated README.md with comprehensive CLI command documentation - Updated README_CN.md with Chinese documentation reflecting v2.0 features - Added Qwen CLI commands and improved Gemini/Codex command descriptions - Enhanced brainstorming role commands and workflow session management - Updated integration requirements for all three CLI tools Script cleanup: - Removed unused Python CLI scripts (install_pycli.sh, pycli, pycli.conf) - Removed deprecated path reading scripts (read-paths.sh, read-task-paths.sh) - Removed tech-stack-loader.sh - Kept core scripts: gemini-wrapper, qwen-wrapper, get_modules_by_depth.sh Architecture improvements: - JSON-First data model as single source of truth - Atomic session management with marker files - Multi-agent coordination for complex task execution - Role-based brainstorming with synthesis capabilities 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,294 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
#==============================================================================
|
||||
# pycli Installation Script
|
||||
#
|
||||
# This script installs the pycli bash wrapper and configuration files
|
||||
# to the ~/.claude directory structure.
|
||||
#==============================================================================
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Print colored output
|
||||
print_status() {
|
||||
echo -e "${BLUE}[INFO]${NC} $1"
|
||||
}
|
||||
|
||||
print_success() {
|
||||
echo -e "${GREEN}[SUCCESS]${NC} $1"
|
||||
}
|
||||
|
||||
print_warning() {
|
||||
echo -e "${YELLOW}[WARNING]${NC} $1"
|
||||
}
|
||||
|
||||
print_error() {
|
||||
echo -e "${RED}[ERROR]${NC} $1"
|
||||
}
|
||||
|
||||
#==============================================================================
|
||||
# Configuration
|
||||
#==============================================================================
|
||||
|
||||
SOURCE_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
INSTALL_BASE="$HOME/.claude"
|
||||
INSTALL_DIR="$INSTALL_BASE/scripts"
|
||||
PYTHON_SCRIPT_DIR="$INSTALL_BASE/python_script"
|
||||
VECTOR_DB_DIR="$INSTALL_BASE/vector_db"
|
||||
CONFIG_DIR="$INSTALL_BASE/config"
|
||||
LOGS_DIR="$INSTALL_BASE/logs"
|
||||
|
||||
#==============================================================================
|
||||
# Pre-installation Checks
|
||||
#==============================================================================
|
||||
|
||||
print_status "Starting pycli installation..."
|
||||
print_status "Source directory: $SOURCE_DIR"
|
||||
print_status "Install directory: $INSTALL_DIR"
|
||||
|
||||
# Check if source files exist
|
||||
if [[ ! -f "$SOURCE_DIR/pycli" ]]; then
|
||||
print_error "pycli script not found in $SOURCE_DIR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "$SOURCE_DIR/pycli.conf" ]]; then
|
||||
print_error "pycli.conf not found in $SOURCE_DIR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if Python script directory exists
|
||||
if [[ ! -d "$PYTHON_SCRIPT_DIR" ]]; then
|
||||
print_warning "Python script directory not found: $PYTHON_SCRIPT_DIR"
|
||||
print_status "Please ensure the Python scripts are installed in ~/.claude/python_script/"
|
||||
read -p "Continue installation anyway? (y/N): " -n 1 -r
|
||||
echo
|
||||
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
||||
print_status "Installation cancelled."
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
#==============================================================================
|
||||
# Create Directory Structure
|
||||
#==============================================================================
|
||||
|
||||
print_status "Creating directory structure..."
|
||||
|
||||
# Create all required directories
|
||||
directories=(
|
||||
"$INSTALL_BASE"
|
||||
"$INSTALL_DIR"
|
||||
"$VECTOR_DB_DIR"
|
||||
"$CONFIG_DIR"
|
||||
"$LOGS_DIR"
|
||||
)
|
||||
|
||||
for dir in "${directories[@]}"; do
|
||||
if [[ ! -d "$dir" ]]; then
|
||||
mkdir -p "$dir"
|
||||
print_status "Created directory: $dir"
|
||||
else
|
||||
print_status "Directory exists: $dir"
|
||||
fi
|
||||
done
|
||||
|
||||
#==============================================================================
|
||||
# Install Files
|
||||
#==============================================================================
|
||||
|
||||
print_status "Installing pycli files..."
|
||||
|
||||
# Backup existing files if they exist
|
||||
if [[ -f "$INSTALL_DIR/pycli" ]]; then
|
||||
backup_file="$INSTALL_DIR/pycli.backup.$(date +%Y%m%d_%H%M%S)"
|
||||
cp "$INSTALL_DIR/pycli" "$backup_file"
|
||||
print_warning "Backed up existing pycli to: $backup_file"
|
||||
fi
|
||||
|
||||
if [[ -f "$INSTALL_DIR/pycli.conf" ]]; then
|
||||
backup_file="$INSTALL_DIR/pycli.conf.backup.$(date +%Y%m%d_%H%M%S)"
|
||||
cp "$INSTALL_DIR/pycli.conf" "$backup_file"
|
||||
print_warning "Backed up existing pycli.conf to: $backup_file"
|
||||
fi
|
||||
|
||||
# Copy files
|
||||
cp "$SOURCE_DIR/pycli" "$INSTALL_DIR/"
|
||||
cp "$SOURCE_DIR/pycli.conf" "$INSTALL_DIR/"
|
||||
|
||||
# Make executable
|
||||
chmod +x "$INSTALL_DIR/pycli"
|
||||
|
||||
print_success "Files installed successfully"
|
||||
|
||||
#==============================================================================
|
||||
# Configuration Updates
|
||||
#==============================================================================
|
||||
|
||||
print_status "Updating configuration..."
|
||||
|
||||
# Detect Python path
|
||||
PYTHON_CANDIDATES=(
|
||||
"/usr/bin/python3"
|
||||
"/usr/local/bin/python3"
|
||||
"/opt/conda/bin/python"
|
||||
"$(which python3 2>/dev/null || echo "")"
|
||||
"$(which python 2>/dev/null || echo "")"
|
||||
)
|
||||
|
||||
DETECTED_PYTHON=""
|
||||
for candidate in "${PYTHON_CANDIDATES[@]}"; do
|
||||
if [[ -n "$candidate" ]] && [[ -x "$candidate" ]]; then
|
||||
# Test if it's Python 3
|
||||
if "$candidate" -c "import sys; exit(0 if sys.version_info >= (3, 6) else 1)" 2>/dev/null; then
|
||||
DETECTED_PYTHON="$candidate"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ -n "$DETECTED_PYTHON" ]]; then
|
||||
print_success "Detected Python: $DETECTED_PYTHON"
|
||||
|
||||
# Update configuration file
|
||||
sed -i.bak "s|^PYTHON_PATH=.*|PYTHON_PATH=\"$DETECTED_PYTHON\"|" "$INSTALL_DIR/pycli.conf"
|
||||
print_status "Updated PYTHON_PATH in configuration"
|
||||
else
|
||||
print_warning "Could not detect Python 3.6+. Please manually update PYTHON_PATH in:"
|
||||
print_warning " $INSTALL_DIR/pycli.conf"
|
||||
fi
|
||||
|
||||
#==============================================================================
|
||||
# Shell Integration Setup
|
||||
#==============================================================================
|
||||
|
||||
print_status "Setting up shell integration..."
|
||||
|
||||
# Detect shell
|
||||
SHELL_RC=""
|
||||
if [[ -n "${BASH_VERSION:-}" ]] || [[ "$SHELL" == *"bash"* ]]; then
|
||||
SHELL_RC="$HOME/.bashrc"
|
||||
elif [[ -n "${ZSH_VERSION:-}" ]] || [[ "$SHELL" == *"zsh"* ]]; then
|
||||
SHELL_RC="$HOME/.zshrc"
|
||||
fi
|
||||
|
||||
# Function to add alias/path to shell config
|
||||
add_to_shell_config() {
|
||||
local config_file="$1"
|
||||
local content="$2"
|
||||
|
||||
if [[ -f "$config_file" ]]; then
|
||||
if ! grep -q "pycli" "$config_file"; then
|
||||
echo "" >> "$config_file"
|
||||
echo "# pycli - Python CLI Wrapper" >> "$config_file"
|
||||
echo "$content" >> "$config_file"
|
||||
print_success "Added pycli to $config_file"
|
||||
return 0
|
||||
else
|
||||
print_warning "pycli already configured in $config_file"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
# Add pycli to PATH
|
||||
PATH_ADDED=false
|
||||
|
||||
if [[ -n "$SHELL_RC" ]]; then
|
||||
# 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
|
||||
|
||||
#==============================================================================
|
||||
# Test Installation
|
||||
#==============================================================================
|
||||
|
||||
print_status "Testing installation..."
|
||||
|
||||
# Test that the script is executable
|
||||
if [[ -x "$INSTALL_DIR/pycli" ]]; then
|
||||
print_success "pycli script is executable"
|
||||
else
|
||||
print_error "pycli script is not executable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Test configuration loading
|
||||
if "$INSTALL_DIR/pycli" --help >/dev/null 2>&1; then
|
||||
print_success "pycli configuration loads correctly"
|
||||
else
|
||||
print_warning "pycli configuration test failed - check Python path"
|
||||
fi
|
||||
|
||||
#==============================================================================
|
||||
# Installation Summary
|
||||
#==============================================================================
|
||||
|
||||
print_success "Installation completed successfully!"
|
||||
echo
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo "📁 Installation Summary:"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo " • Executable: $INSTALL_DIR/pycli"
|
||||
echo " • Config: $INSTALL_DIR/pycli.conf"
|
||||
echo " • Vector DB: $VECTOR_DB_DIR/"
|
||||
echo " • Logs: $LOGS_DIR/"
|
||||
echo
|
||||
|
||||
echo "🚀 Quick Start:"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
|
||||
if [[ "$PATH_ADDED" == true ]]; then
|
||||
echo " 1. Reload your shell configuration:"
|
||||
echo " source $SHELL_RC"
|
||||
echo
|
||||
echo " 2. Initialize vector DB for a project:"
|
||||
echo " cd /path/to/your/project"
|
||||
echo " pycli --init"
|
||||
echo
|
||||
echo " 3. Start analyzing code:"
|
||||
echo " pycli --analyze --query \"authentication patterns\" --tool gemini"
|
||||
else
|
||||
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 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"
|
||||
echo " pycli --init"
|
||||
echo
|
||||
echo " 4. Start analyzing code:"
|
||||
echo " pycli --analyze --query \"authentication patterns\" --tool gemini"
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "📚 Documentation:"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo " • Help: pycli --help"
|
||||
echo " • Strategy: ~/.claude/workflows/python-tools-strategy.md"
|
||||
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! Now you can use 'pycli' command directly! 🎉"
|
||||
@@ -1,225 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
#==============================================================================
|
||||
# pycli - Python CLI Wrapper with Hierarchical Vector Database Support
|
||||
#
|
||||
# This script provides a bash wrapper for the Python-based analysis CLI,
|
||||
# with intelligent hierarchical vector database management.
|
||||
#
|
||||
# Features:
|
||||
# - Hierarchical vector database support (subdirs use parent's DB)
|
||||
# - Configurable Python environment
|
||||
# - Central vector database storage
|
||||
# - Smart project root detection
|
||||
#==============================================================================
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Load configuration
|
||||
CONFIG_FILE="$(dirname "$0")/pycli.conf"
|
||||
if [[ -f "$CONFIG_FILE" ]]; then
|
||||
source "$CONFIG_FILE"
|
||||
else
|
||||
echo "Error: Configuration file not found: $CONFIG_FILE"
|
||||
echo "Please ensure pycli.conf exists in the same directory as this script."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Validate required configuration
|
||||
if [[ -z "${PYTHON_PATH:-}" ]]; then
|
||||
echo "Error: PYTHON_PATH not set in configuration"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "${PYTHON_SCRIPT_DIR:-}" ]]; then
|
||||
echo "Error: PYTHON_SCRIPT_DIR not set in configuration"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "${VECTOR_DB_ROOT:-}" ]]; then
|
||||
echo "Error: VECTOR_DB_ROOT not set in configuration"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if Python is available
|
||||
if ! command -v "$PYTHON_PATH" &> /dev/null; then
|
||||
echo "Error: Python not found at $PYTHON_PATH"
|
||||
echo "Please update PYTHON_PATH in $CONFIG_FILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if Python script directory exists
|
||||
if [[ ! -d "$PYTHON_SCRIPT_DIR" ]]; then
|
||||
echo "Error: Python script directory not found: $PYTHON_SCRIPT_DIR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get current directory (will be used as project root for indexing)
|
||||
CURRENT_DIR=$(pwd)
|
||||
|
||||
#==============================================================================
|
||||
# Helper Functions
|
||||
#==============================================================================
|
||||
|
||||
# Convert current path to vector DB path
|
||||
# e.g., /home/user/project/subdir -> ~/.claude/vector_db/home_user_project_subdir
|
||||
get_vector_db_path() {
|
||||
local path="$1"
|
||||
# Replace / with _ and remove leading /
|
||||
local safe_path="${path//\//_}"
|
||||
safe_path="${safe_path#_}"
|
||||
# Handle Windows paths (C: -> C_)
|
||||
safe_path="${safe_path//:/_}"
|
||||
echo "$VECTOR_DB_ROOT/$safe_path"
|
||||
}
|
||||
|
||||
# Find nearest parent with existing vector DB
|
||||
find_project_root() {
|
||||
local dir="$CURRENT_DIR"
|
||||
local max_depth=10 # Prevent infinite loops
|
||||
local depth=0
|
||||
|
||||
while [[ "$dir" != "/" ]] && [[ "$depth" -lt "$max_depth" ]]; do
|
||||
local db_path=$(get_vector_db_path "$dir")
|
||||
|
||||
# Check if vector DB exists and has required files
|
||||
if [[ -d "$db_path" ]] && ([[ -f "$db_path/embeddings.pkl" ]] || [[ -f "$db_path/index.json" ]]); then
|
||||
echo "$dir"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Move to parent directory
|
||||
local parent_dir=$(dirname "$dir")
|
||||
if [[ "$parent_dir" == "$dir" ]]; then
|
||||
break # Reached root
|
||||
fi
|
||||
dir="$parent_dir"
|
||||
((depth++))
|
||||
done
|
||||
|
||||
# No parent vector DB found, use current directory
|
||||
echo "$CURRENT_DIR"
|
||||
}
|
||||
|
||||
# Show help message
|
||||
show_help() {
|
||||
cat << EOF
|
||||
pycli - Python CLI Wrapper with Hierarchical Vector Database Support
|
||||
|
||||
USAGE:
|
||||
pycli [OPTIONS]
|
||||
|
||||
INITIALIZATION:
|
||||
--init Initialize vector DB for current directory
|
||||
--rebuild-index Rebuild file index from scratch
|
||||
--update-embeddings Update vector embeddings for changed files
|
||||
|
||||
ANALYSIS:
|
||||
--analyze Run analysis with tool
|
||||
--query TEXT Semantic search query for context discovery
|
||||
-p, --prompt TEXT Direct prompt for analysis
|
||||
--tool [gemini|codex|both] Which tool to use (default: $DEFAULT_TOOL)
|
||||
--top-k INTEGER Number of similar files to find (default: $DEFAULT_TOP_K)
|
||||
|
||||
STATUS:
|
||||
--status Show system status
|
||||
--test-search Test vector search functionality
|
||||
|
||||
EXAMPLES:
|
||||
# Initialize vector DB for current project
|
||||
pycli --init
|
||||
|
||||
# Smart analysis with context discovery
|
||||
pycli --analyze --query "authentication patterns" --tool gemini
|
||||
|
||||
# Direct analysis with known prompt
|
||||
pycli --analyze --tool codex -p "implement user login"
|
||||
|
||||
# Update embeddings after code changes
|
||||
pycli --update-embeddings
|
||||
|
||||
# Check system status
|
||||
pycli --status
|
||||
|
||||
For more information, see: ~/.claude/workflows/python-tools-strategy.md
|
||||
EOF
|
||||
}
|
||||
|
||||
#==============================================================================
|
||||
# Main Logic
|
||||
#==============================================================================
|
||||
|
||||
# Handle help
|
||||
if [[ "${1:-}" == "--help" ]] || [[ "${1:-}" == "-h" ]] || [[ $# -eq 0 ]]; then
|
||||
show_help
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Determine action based on arguments
|
||||
case "${1:-}" in
|
||||
--init|--rebuild-index)
|
||||
# For initialization, always use current directory
|
||||
PROJECT_ROOT="$CURRENT_DIR"
|
||||
echo "Initializing vector database for: $PROJECT_ROOT"
|
||||
;;
|
||||
*)
|
||||
# For other operations, find nearest project root
|
||||
PROJECT_ROOT=$(find_project_root)
|
||||
if [[ "$PROJECT_ROOT" != "$CURRENT_DIR" ]]; then
|
||||
echo "Using existing vector database from: $PROJECT_ROOT"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
VECTOR_DB_PATH=$(get_vector_db_path "$PROJECT_ROOT")
|
||||
|
||||
# Create vector DB directory if needed
|
||||
mkdir -p "$VECTOR_DB_PATH"
|
||||
|
||||
# Determine which Python script to call
|
||||
if [[ "${1:-}" == "--update-embeddings" ]] || [[ "${1:-}" == "--rebuild-index" ]] || [[ "${1:-}" == "--init" ]]; then
|
||||
# Use indexer.py for indexing operations
|
||||
PYTHON_SCRIPT="$PYTHON_SCRIPT_DIR/indexer.py"
|
||||
|
||||
# Map --init to --rebuild-index --update-embeddings
|
||||
if [[ "${1:-}" == "--init" ]]; then
|
||||
set -- "--rebuild-index" "--update-embeddings"
|
||||
fi
|
||||
|
||||
if [[ ! -f "$PYTHON_SCRIPT" ]]; then
|
||||
echo "Error: indexer.py not found at $PYTHON_SCRIPT"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
# Use cli.py for analysis operations
|
||||
PYTHON_SCRIPT="$PYTHON_SCRIPT_DIR/cli.py"
|
||||
|
||||
if [[ ! -f "$PYTHON_SCRIPT" ]]; then
|
||||
echo "Error: cli.py not found at $PYTHON_SCRIPT"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
#==============================================================================
|
||||
# Environment Setup and Execution
|
||||
#==============================================================================
|
||||
|
||||
# Set environment variables for Python scripts
|
||||
export PYCLI_VECTOR_DB_PATH="$VECTOR_DB_PATH"
|
||||
export PYCLI_PROJECT_ROOT="$PROJECT_ROOT"
|
||||
export PYCLI_CONFIG_FILE="$CONFIG_FILE"
|
||||
|
||||
# Add some debugging info in verbose mode
|
||||
if [[ "${PYCLI_VERBOSE:-}" == "1" ]]; then
|
||||
echo "Debug: PROJECT_ROOT=$PROJECT_ROOT"
|
||||
echo "Debug: VECTOR_DB_PATH=$VECTOR_DB_PATH"
|
||||
echo "Debug: PYTHON_SCRIPT=$PYTHON_SCRIPT"
|
||||
echo "Debug: Arguments: $*"
|
||||
fi
|
||||
|
||||
# Execute Python script with all arguments
|
||||
echo "Executing: $PYTHON_PATH $PYTHON_SCRIPT --root-path \"$PROJECT_ROOT\" $*"
|
||||
|
||||
exec "$PYTHON_PATH" "$PYTHON_SCRIPT" \
|
||||
--root-path "$PROJECT_ROOT" \
|
||||
"$@"
|
||||
@@ -1,159 +0,0 @@
|
||||
#==============================================================================
|
||||
# pycli Configuration File
|
||||
#
|
||||
# This file contains configuration settings for the pycli bash wrapper.
|
||||
# Modify these settings according to your environment.
|
||||
#==============================================================================
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Python Environment Configuration
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Path to Python interpreter
|
||||
# Examples:
|
||||
# - System Python: /usr/bin/python3
|
||||
# - Conda: /opt/conda/bin/python
|
||||
# - Virtual env: /home/user/.virtualenvs/myenv/bin/python
|
||||
# - Windows: /c/Python39/python.exe
|
||||
PYTHON_PATH="/usr/bin/python3"
|
||||
|
||||
# Alternative Python paths for different environments
|
||||
# Uncomment and modify as needed:
|
||||
# PYTHON_PATH="/opt/conda/bin/python" # Conda
|
||||
# PYTHON_PATH="$HOME/.pyenv/versions/3.11.0/bin/python" # pyenv
|
||||
# PYTHON_PATH="/c/Python311/python.exe" # Windows
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Directory Configuration
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Python script location (should point to ~/.claude/python_script)
|
||||
PYTHON_SCRIPT_DIR="$HOME/.claude/python_script"
|
||||
|
||||
# Central vector database storage location
|
||||
VECTOR_DB_ROOT="$HOME/.claude/vector_db"
|
||||
|
||||
# Cache directory for temporary files
|
||||
CACHE_DIR="$HOME/.claude/cache"
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Default Tool Settings
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Default tool to use when not specified
|
||||
# Options: gemini, codex, both
|
||||
DEFAULT_TOOL="gemini"
|
||||
|
||||
# Default number of similar files to return in vector search
|
||||
DEFAULT_TOP_K="10"
|
||||
|
||||
# Default similarity threshold for vector search (0.0-1.0)
|
||||
SIMILARITY_THRESHOLD="0.3"
|
||||
|
||||
# Default timeout for tool execution (seconds)
|
||||
TOOL_TIMEOUT="300"
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Vector Database Configuration
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Enable hierarchical vector database mode
|
||||
# When true, subdirectories will use parent directory's vector database
|
||||
HIERARCHICAL_MODE="true"
|
||||
|
||||
# Maximum depth to search for parent vector databases
|
||||
MAX_SEARCH_DEPTH="10"
|
||||
|
||||
# Minimum files required to create a separate vector database
|
||||
MIN_FILES_FOR_SEPARATE_DB="50"
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Performance Settings
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Enable verbose output for debugging
|
||||
# Set to "1" to enable, "0" to disable
|
||||
PYCLI_VERBOSE="0"
|
||||
|
||||
# Enable caching of analysis results
|
||||
ENABLE_CACHING="true"
|
||||
|
||||
# Cache TTL in seconds (1 hour default)
|
||||
CACHE_TTL="3600"
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Integration Settings
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Gemini wrapper compatibility mode
|
||||
# Set to "true" to enable compatibility with existing gemini-wrapper scripts
|
||||
GEMINI_COMPAT_MODE="true"
|
||||
|
||||
# Codex integration settings
|
||||
CODEX_COMPAT_MODE="true"
|
||||
|
||||
# Auto-build index if not found
|
||||
AUTO_BUILD_INDEX="true"
|
||||
|
||||
# Auto-update embeddings when files change
|
||||
AUTO_UPDATE_EMBEDDINGS="true"
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Logging Configuration
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Log level: DEBUG, INFO, WARNING, ERROR
|
||||
LOG_LEVEL="INFO"
|
||||
|
||||
# Log file location
|
||||
LOG_FILE="$HOME/.claude/logs/pycli.log"
|
||||
|
||||
# Enable log rotation
|
||||
ENABLE_LOG_ROTATION="true"
|
||||
|
||||
# Maximum log file size (MB)
|
||||
MAX_LOG_SIZE="10"
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Advanced Configuration
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Custom configuration file for Python scripts
|
||||
# Leave empty to use default config.yaml
|
||||
PYTHON_CONFIG_FILE=""
|
||||
|
||||
# Additional Python path directories
|
||||
# Uncomment and modify if you need to add custom modules
|
||||
# ADDITIONAL_PYTHON_PATH="/path/to/custom/modules"
|
||||
|
||||
# Environment variables to pass to Python scripts
|
||||
# Uncomment and modify as needed
|
||||
# CUSTOM_ENV_VAR1="value1"
|
||||
# CUSTOM_ENV_VAR2="value2"
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Platform-Specific Settings
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Windows-specific settings
|
||||
if [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "cygwin" ]]; then
|
||||
# Adjust paths for Windows
|
||||
VECTOR_DB_ROOT="${VECTOR_DB_ROOT//\\//}"
|
||||
PYTHON_SCRIPT_DIR="${PYTHON_SCRIPT_DIR//\\//}"
|
||||
fi
|
||||
|
||||
# macOS-specific settings
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
# macOS-specific optimizations
|
||||
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# User Customization
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Load user-specific configuration if it exists
|
||||
USER_CONFIG="$HOME/.claude/config/pycli.user.conf"
|
||||
if [[ -f "$USER_CONFIG" ]]; then
|
||||
source "$USER_CONFIG"
|
||||
fi
|
||||
@@ -1,35 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# read-paths.sh - Simple path reader for gemini format
|
||||
# Usage: read-paths.sh <paths_file>
|
||||
|
||||
PATHS_FILE="$1"
|
||||
|
||||
# Check file exists
|
||||
if [ ! -f "$PATHS_FILE" ]; then
|
||||
echo "❌ File not found: $PATHS_FILE" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Read valid paths
|
||||
valid_paths=()
|
||||
while IFS= read -r line; do
|
||||
# Skip comments and empty lines
|
||||
[[ -z "$line" || "$line" =~ ^[[:space:]]*# ]] && continue
|
||||
|
||||
# Clean and add path
|
||||
path=$(echo "$line" | xargs)
|
||||
[ -n "$path" ] && valid_paths+=("$path")
|
||||
done < "$PATHS_FILE"
|
||||
|
||||
# Check if we have paths
|
||||
if [ ${#valid_paths[@]} -eq 0 ]; then
|
||||
echo "❌ No valid paths found in $PATHS_FILE" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Output gemini format @{path1,path2,...}
|
||||
printf "@{"
|
||||
printf "%s" "${valid_paths[0]}"
|
||||
printf ",%s" "${valid_paths[@]:1}"
|
||||
printf "}"
|
||||
@@ -1,56 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Read paths field from task JSON and convert to Gemini @ format
|
||||
# Usage: read-task-paths.sh [task-json-file]
|
||||
|
||||
TASK_FILE="$1"
|
||||
|
||||
if [ -z "$TASK_FILE" ]; then
|
||||
echo "Usage: read-task-paths.sh [task-json-file]" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "$TASK_FILE" ]; then
|
||||
echo "Error: Task file '$TASK_FILE' not found" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Extract paths field from JSON
|
||||
paths=$(grep -o '"paths":[[:space:]]*"[^"]*"' "$TASK_FILE" | sed 's/"paths":[[:space:]]*"\([^"]*\)"/\1/')
|
||||
|
||||
if [ -z "$paths" ]; then
|
||||
# No paths field found, return empty @ format
|
||||
echo "@{}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Convert semicolon-separated paths to comma-separated @ format
|
||||
formatted_paths=$(echo "$paths" | sed 's/;/,/g')
|
||||
|
||||
# For directories, append /**/* to get all files
|
||||
# For files (containing .), keep as-is
|
||||
IFS=',' read -ra path_array <<< "$formatted_paths"
|
||||
result_paths=()
|
||||
|
||||
for path in "${path_array[@]}"; do
|
||||
# Trim whitespace
|
||||
path=$(echo "$path" | xargs)
|
||||
|
||||
if [ -n "$path" ]; then
|
||||
# Check if path is a directory (no extension) or file (has extension)
|
||||
if [[ "$path" == *.* ]]; then
|
||||
# File path - keep as is
|
||||
result_paths+=("$path")
|
||||
else
|
||||
# Directory path - add wildcard expansion
|
||||
result_paths+=("$path/**/*")
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# Output Gemini @ format
|
||||
printf "@{"
|
||||
printf "%s" "${result_paths[0]}"
|
||||
for i in "${result_paths[@]:1}"; do
|
||||
printf ",%s" "$i"
|
||||
done
|
||||
printf "}"
|
||||
@@ -1,101 +0,0 @@
|
||||
#!/bin/bash
|
||||
# tech-stack-loader.sh - DMSFlow Tech Stack Guidelines Loader
|
||||
# Returns tech stack specific coding guidelines and best practices for Claude processing
|
||||
|
||||
set -e
|
||||
|
||||
# Define paths
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
TEMPLATE_DIR="${SCRIPT_DIR}/../tech-stack-templates"
|
||||
|
||||
# Parse arguments
|
||||
COMMAND="$1"
|
||||
TECH_STACK="$2"
|
||||
|
||||
# Handle version check
|
||||
if [ "$COMMAND" = "--version" ] || [ "$COMMAND" = "-v" ]; then
|
||||
echo "DMSFlow tech-stack-loader v2.0"
|
||||
echo "Semantic-based development guidelines system"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# List all available guidelines
|
||||
if [ "$COMMAND" = "--list" ]; then
|
||||
echo "Available Development Guidelines:"
|
||||
echo "================================="
|
||||
for file in "$TEMPLATE_DIR"/*.md; do
|
||||
if [ -f "$file" ]; then
|
||||
# Extract name and description from YAML frontmatter
|
||||
name=$(grep "^name:" "$file" | head -1 | cut -d: -f2 | sed 's/^ *//' | sed 's/ *$//')
|
||||
desc=$(grep "^description:" "$file" | head -1 | cut -d: -f2- | sed 's/^ *//' | sed 's/ *$//')
|
||||
|
||||
if [ -n "$name" ] && [ -n "$desc" ]; then
|
||||
printf "%-20s - %s\n" "$name" "$desc"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Load specific guidelines
|
||||
if [ "$COMMAND" = "--load" ] && [ -n "$TECH_STACK" ]; then
|
||||
TEMPLATE_PATH="${TEMPLATE_DIR}/${TECH_STACK}.md"
|
||||
|
||||
if [ -f "$TEMPLATE_PATH" ]; then
|
||||
# Output content, skipping YAML frontmatter
|
||||
awk '
|
||||
BEGIN { in_yaml = 0; yaml_ended = 0 }
|
||||
/^---$/ {
|
||||
if (!yaml_ended) {
|
||||
if (in_yaml) yaml_ended = 1
|
||||
else in_yaml = 1
|
||||
next
|
||||
}
|
||||
}
|
||||
yaml_ended { print }
|
||||
' "$TEMPLATE_PATH"
|
||||
else
|
||||
>&2 echo "Error: Development guidelines '$TECH_STACK' not found"
|
||||
>&2 echo "Use --list to see available guidelines"
|
||||
exit 1
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Handle legacy usage (direct tech stack name)
|
||||
if [ -n "$COMMAND" ] && [ "$COMMAND" != "--help" ] && [ "$COMMAND" != "--list" ] && [ "$COMMAND" != "--load" ]; then
|
||||
TEMPLATE_PATH="${TEMPLATE_DIR}/${COMMAND}.md"
|
||||
|
||||
if [ -f "$TEMPLATE_PATH" ]; then
|
||||
# Output content, skipping YAML frontmatter
|
||||
awk '
|
||||
BEGIN { in_yaml = 0; yaml_ended = 0 }
|
||||
/^---$/ {
|
||||
if (!yaml_ended) {
|
||||
if (in_yaml) yaml_ended = 1
|
||||
else in_yaml = 1
|
||||
next
|
||||
}
|
||||
}
|
||||
yaml_ended { print }
|
||||
' "$TEMPLATE_PATH"
|
||||
exit 0
|
||||
else
|
||||
>&2 echo "Error: Development guidelines '$COMMAND' not found"
|
||||
>&2 echo "Use --list to see available guidelines"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Show help
|
||||
echo "Usage:"
|
||||
echo " tech-stack-loader.sh --list List all available guidelines with descriptions"
|
||||
echo " tech-stack-loader.sh --load <name> Load specific development guidelines"
|
||||
echo " tech-stack-loader.sh <name> Load specific guidelines (legacy format)"
|
||||
echo " tech-stack-loader.sh --help Show this help message"
|
||||
echo " tech-stack-loader.sh --version Show version information"
|
||||
echo ""
|
||||
echo "Examples:"
|
||||
echo " tech-stack-loader.sh --list"
|
||||
echo " tech-stack-loader.sh --load javascript-dev"
|
||||
echo " tech-stack-loader.sh python-dev"
|
||||
@@ -37,7 +37,7 @@ type: strategic-guideline
|
||||
### Standard Format (REQUIRED)
|
||||
```bash
|
||||
# Gemini Analysis
|
||||
~/.claude/scripts/gemini-wrapper [-C directory] -p "
|
||||
~/.claude/scripts/gemini-wrapper -C [directory] -p "
|
||||
PURPOSE: [clear analysis goal]
|
||||
TASK: [specific analysis task]
|
||||
CONTEXT: [file references and memory context]
|
||||
@@ -46,7 +46,7 @@ RULES: [template reference and constraints]
|
||||
"
|
||||
|
||||
# Qwen Architecture & Code Generation
|
||||
~/.claude/scripts/qwen-wrapper [-C directory] -p "
|
||||
~/.claude/scripts/qwen-wrapper -C [directory] -p "
|
||||
PURPOSE: [clear architecture/code goal]
|
||||
TASK: [specific architecture/code task]
|
||||
CONTEXT: [file references and memory context]
|
||||
@@ -55,7 +55,7 @@ RULES: [template reference and constraints]
|
||||
"
|
||||
|
||||
# Codex Development
|
||||
codex [-C directory] --full-auto exec "
|
||||
codex -C [directory] --full-auto exec "
|
||||
PURPOSE: [clear development goal]
|
||||
TASK: [specific development task]
|
||||
CONTEXT: [file references and memory context]
|
||||
|
||||
Reference in New Issue
Block a user