directory-indexer 0.0.10

AI-powered directory indexing with semantic search for MCP servers
Documentation
#!/bin/bash

# Pre-push hook for directory-indexer
# Run essential quality checks before pushing code

set -e

echo "Running pre-push checks..."

# Check if we're in a Rust project
if [ ! -f "Cargo.toml" ]; then
    echo "ERROR: Cargo.toml not found. This script should be run from the project root."
    exit 1
fi

echo "Checking version synchronization..."
# Extract version from Cargo.toml
CARGO_VERSION=$(grep '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')

# Extract version from package.json
NPM_VERSION=$(grep '"version":' package.json | head -1 | sed 's/.*"version": "\(.*\)".*/\1/')

if [ "$CARGO_VERSION" != "$NPM_VERSION" ]; then
    echo "ERROR: Version mismatch detected!"
    echo "  Cargo.toml version: $CARGO_VERSION"
    echo "  package.json version: $NPM_VERSION"
    echo "  Please ensure both files have the same version."
    exit 1
fi

echo "Running clippy (linter)..."
# Check main library code with strict linting
cargo clippy --lib --all-features -- -D warnings -D clippy::uninlined_format_args
# Check other targets with standard linting (tests can be less strict)
cargo clippy --bins --all-features -- -D warnings

echo "Checking code formatting..."
cargo fmt --check

echo "Running tests..."
export DIRECTORY_INDEXER_DATA_DIR=/tmp/directory-indexer-test
export DIRECTORY_INDEXER_QDRANT_COLLECTION=directory-indexer-test

cargo test --lib
cargo test tests

echo "Checking for security vulnerabilities..."
if command -v cargo-audit >/dev/null 2>&1; then
    cargo audit
else
    echo "Installing cargo-audit..."
    cargo install cargo-audit
    cargo audit
fi

echo "All pre-push checks passed!"