Files
mcp-ssh-orchestrator/scripts/setup-pre-commit.sh
T
Sammy Farida f874b13d34 Security/fix command chaining bypass (#68)
* fix: Remove unused variable in fix-markdownlint.py

* fix: Remove unused code_block_lang variable

* chore: Update documentation, workflows, and examples

- Updated all wiki documentation files (markdownlint fixes)
- Updated GitHub workflows and issue templates
- Updated example configuration files
- Updated metadata.json and pyproject.toml
- Updated Dockerfile and compose files
- Updated validation scripts

Note: yamllint warnings are style-only (missing ---, line length) and don't affect functionality
2025-11-18 07:00:42 -05:00

45 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# Setup pre-commit hooks for mcp-ssh-orchestrator
#
# This script installs and configures pre-commit hooks to ensure code quality
# before commits are made to the repository.
#
# Usage:
# ./scripts/setup-pre-commit.sh
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
echo "Setting up pre-commit hooks for mcp-ssh-orchestrator..."
echo "Project root: $PROJECT_ROOT"
# Check if pre-commit is installed
if ! command -v pre-commit &> /dev/null; then
echo "Error: pre-commit is not installed"
echo "Install it with: pip install pre-commit"
echo "Or: pip install '.[dev]'"
exit 1
fi
# Check if .pre-commit-config.yaml exists
if [ ! -f "$PROJECT_ROOT/.pre-commit-config.yaml" ]; then
echo "Error: .pre-commit-config.yaml not found in project root"
exit 1
fi
# Install pre-commit hooks
cd "$PROJECT_ROOT"
pre-commit install
echo ""
echo "Pre-commit hooks installed successfully!"
echo ""
echo "To test the hooks, run:"
echo " pre-commit run --all-files"
echo ""
echo "To skip hooks for a commit, use:"
echo " git commit --no-verify"
echo ""