-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpre-commit.sh
More file actions
47 lines (40 loc) · 1.07 KB
/
pre-commit.sh
File metadata and controls
47 lines (40 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
# Pre-commit hook for LocalCode
# Run this once to enable: cp pre-commit.sh .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit
set -e
echo "Running pre-commit checks..."
# Find Go binary
GO_PATH="$HOME/go/bin/go"
if [ ! -f "$GO_PATH" ]; then
GO_PATH="$(which go 2>/dev/null)"
fi
if [ -z "$GO_PATH" ]; then
echo "WARNING: Go not found, skipping Go build and tests"
else
# Build Go TUI
echo "Building Go TUI..."
cd LocalCode
if ! "$GO_PATH" build -o localcode . 2>&1; then
echo "FAILED: Go build failed"
exit 1
fi
echo "Go build: OK"
# Run Go tests
echo "Running Go tests..."
if ! "$GO_PATH" test -v . 2>&1; then
echo "FAILED: Go tests failed"
exit 1
fi
echo "Go tests: OK"
cd ..
fi
# Build Swift AFM helper
echo "Building Swift AFM helper..."
cd LocalCode/Sources/afmhelper
if ! swiftc -o afmhelper main.swift -framework FoundationModels -target arm64-apple-macosx26.0 2>&1; then
echo "FAILED: Swift build failed"
exit 1
fi
echo "Swift build: OK"
echo ""
echo "All checks passed!"