mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-10-25 06:33:13 +08:00
Delete Go MCP server, CGo bridges, Go pipeline, store, tools, watcher, cypher engine, language specs, and all Go tests. Replace Go pre-commit hook with C-only linting (clang-tidy, cppcheck, clang-format, tests). Tree-sitter extraction engine (internal/cbm/*.c) retained for C pipeline.
43 lines
1.3 KiB
Bash
Executable File
43 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# Pre-commit hook: C linting + tests.
|
|
# Mirrors the lint targets in Makefile.cbm.
|
|
#
|
|
# Setup (once after clone):
|
|
# git config core.hooksPath scripts/hooks
|
|
|
|
LLVM_BIN="$(brew --prefix llvm 2>/dev/null)/bin"
|
|
|
|
# Resolve tool paths (Homebrew LLVM is keg-only on macOS)
|
|
CLANG_TIDY="${LLVM_BIN}/clang-tidy"
|
|
CLANG_FORMAT="${LLVM_BIN}/clang-format"
|
|
[ -x "$CLANG_TIDY" ] || CLANG_TIDY="clang-tidy"
|
|
[ -x "$CLANG_FORMAT" ] || CLANG_FORMAT="clang-format"
|
|
|
|
# --- clang-format (blocking — fastest, check first) ---
|
|
echo "pre-commit: checking formatting..."
|
|
make -f Makefile.cbm lint-format CLANG_FORMAT="$CLANG_FORMAT"
|
|
|
|
# --- cppcheck (blocking) ---
|
|
if command -v cppcheck &>/dev/null; then
|
|
echo "pre-commit: running cppcheck..."
|
|
make -f Makefile.cbm lint-cppcheck
|
|
else
|
|
echo "pre-commit: cppcheck not found, skipping"
|
|
echo " install: brew install cppcheck"
|
|
fi
|
|
|
|
# --- clang-tidy (blocking) ---
|
|
if command -v "$CLANG_TIDY" &>/dev/null; then
|
|
echo "pre-commit: running clang-tidy..."
|
|
make -f Makefile.cbm lint-tidy CLANG_TIDY="$CLANG_TIDY"
|
|
else
|
|
echo "pre-commit: clang-tidy not found, skipping"
|
|
echo " install: brew install llvm"
|
|
fi
|
|
|
|
# --- Build + Tests (blocking) ---
|
|
echo "pre-commit: building and running tests..."
|
|
make -f Makefile.cbm test
|