From 3fbb9a18372f2b6a675dd6c039ba52be76f3eeb4 Mon Sep 17 00:00:00 2001 From: TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> Date: Fri, 16 Jan 2026 08:30:14 +0900 Subject: updates --- .../memory-mcp-server/.claude/hooks/lint-check.sh | 6 +++ .../.claude/hooks/typescript-dev.sh | 57 ++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100755 mcp-servers/memory-mcp-server/.claude/hooks/lint-check.sh create mode 100755 mcp-servers/memory-mcp-server/.claude/hooks/typescript-dev.sh (limited to 'mcp-servers/memory-mcp-server/.claude/hooks') diff --git a/mcp-servers/memory-mcp-server/.claude/hooks/lint-check.sh b/mcp-servers/memory-mcp-server/.claude/hooks/lint-check.sh new file mode 100755 index 0000000..f298837 --- /dev/null +++ b/mcp-servers/memory-mcp-server/.claude/hooks/lint-check.sh @@ -0,0 +1,6 @@ +#!/bin/bash +input=$(cat) +file_path=$(echo "$input" | jq -r '.tool_input.file_path') +if [[ "$file_path" == *.ts || "$file_path" == *.js ]]; then + npm run lint --silent "$file_path" 2>&1 || true +fi \ No newline at end of file diff --git a/mcp-servers/memory-mcp-server/.claude/hooks/typescript-dev.sh b/mcp-servers/memory-mcp-server/.claude/hooks/typescript-dev.sh new file mode 100755 index 0000000..fe390d2 --- /dev/null +++ b/mcp-servers/memory-mcp-server/.claude/hooks/typescript-dev.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +# Enhanced TypeScript development hook +# Handles compilation checks, formatting, and test auto-run + +input=$(cat) +tool_name=$(echo "$input" | jq -r '.tool_name') +file_path=$(echo "$input" | jq -r '.tool_input.file_path // empty') + +# Only process TypeScript/JavaScript files +if [[ ! "$file_path" =~ \.(ts|tsx|js|jsx|mjs)$ ]]; then + exit 0 +fi + +# Skip node_modules and build directories +if [[ "$file_path" == *"/node_modules/"* ]] || [[ "$file_path" == *"/dist/"* ]] || [[ "$file_path" == *"/build/"* ]]; then + exit 0 +fi + +# Extract project directory +PROJECT_DIR="${CLAUDE_PROJECT_DIR:-$(pwd)}" +cd "$PROJECT_DIR" + +# Check if this is a TypeScript project +if [ -f "tsconfig.json" ]; then + # Run TypeScript compiler in check mode (no emit) + if command -v tsc &> /dev/null; then + echo "๐Ÿ” TypeScript check for ${file_path##*/}..." + npx tsc --noEmit --skipLibCheck 2>&1 | head -20 || true + fi +fi + +# Format with prettier if available +if [ -f ".prettierrc" ] || [ -f ".prettierrc.json" ] || [ -f "prettier.config.js" ]; then + if command -v prettier &> /dev/null || [ -f "node_modules/.bin/prettier" ]; then + echo "โœจ Formatting ${file_path##*/}..." + npx prettier --write "$file_path" 2>/dev/null || true + fi +fi + +# Run ESLint if available +if [ -f ".eslintrc.json" ] || [ -f ".eslintrc.js" ] || [ -f "eslint.config.js" ]; then + if command -v eslint &> /dev/null || [ -f "node_modules/.bin/eslint" ]; then + echo "๐Ÿ”ง Linting ${file_path##*/}..." + npx eslint --fix "$file_path" 2>&1 | head -10 || true + fi +fi + +# Auto-run tests if this is a test file modification +if [[ "$file_path" == *".test."* ]] || [[ "$file_path" == *".spec."* ]]; then + if [ -f "package.json" ] && grep -q '"test"' package.json; then + echo "๐Ÿงช Running tests for ${file_path##*/}..." + npm test -- "$file_path" 2>&1 | head -30 || true + fi +fi + +exit 0 \ No newline at end of file -- cgit v1.2.3