@@ -11,7 +11,7 @@ LDFLAGS := -X main.version=$(VERSION) \
1111LDFLAGS_RELEASE := $(LDFLAGS ) -s -w
1212DESKTOP_DIST_DIR := dist/desktop
1313
14- .PHONY : build build-release install frontend frontend-dev dev desktop-dev desktop-build desktop-macos-app desktop-macos-dmg desktop-windows-installer desktop-linux-appimage desktop-app test test-short test-postgres test-postgres-ci postgres-up postgres-down e2e vet lint tidy clean release release-darwin-arm64 release-darwin-amd64 release-linux-amd64 install-hooks ensure-embed-dir help
14+ .PHONY : build build-release install frontend frontend-dev dev desktop-dev desktop-build desktop-macos-app desktop-macos-dmg desktop-windows-installer desktop-linux-appimage desktop-app test test-short test-postgres test-postgres-ci postgres-up postgres-down e2e vet lint lint-ci tidy clean release release-darwin-arm64 release-darwin-amd64 release-linux-amd64 install-hooks ensure-embed-dir help
1515
1616# Ensure go:embed has at least one file (no-op if frontend is built)
1717ensure-embed-dir :
@@ -168,8 +168,16 @@ e2e:
168168vet : ensure-embed-dir
169169 go vet -tags fts5 ./...
170170
171- # Lint Go code with project defaults
171+ # Lint Go code and auto-fix where possible (local development)
172172lint : ensure-embed-dir
173+ @if ! command -v golangci-lint > /dev/null 2>&1 ; then \
174+ echo " golangci-lint not found. Install with: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.10.1" >&2 ; \
175+ exit 1; \
176+ fi
177+ golangci-lint run --fix ./...
178+
179+ # Lint Go code without fixing (for CI)
180+ lint-ci : ensure-embed-dir
173181 @if ! command -v golangci-lint > /dev/null 2>&1 ; then \
174182 echo " golangci-lint not found. Install with: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.10.1" >&2 ; \
175183 exit 1; \
@@ -211,16 +219,13 @@ release-linux-amd64: frontend
211219 -ldflags=" $( LDFLAGS_RELEASE) " -trimpath \
212220 -o dist/agentsview-linux-amd64 ./cmd/agentsview
213221
214- # Install pre-commit hook, resolving the hooks directory via git so
215- # this works in both normal repos and linked worktrees
222+ # Install pre-commit hooks via prek
216223install-hooks :
217- @hooks_rel=$$(git rev-parse --git-path hooks ) && \
218- hooks_dir=$$(cd "$$(dirname "$$hooks_rel" ) " && echo "$$PWD/$$(basename "$$hooks_rel") " ) && \
219- git config --local core.hooksPath " $$ hooks_dir" && \
220- mkdir -p " $$ hooks_dir" && \
221- cp .githooks/pre-commit " $$ hooks_dir/pre-commit" && \
222- chmod +x " $$ hooks_dir/pre-commit" && \
223- echo " Installed pre-commit hook to $$ hooks_dir/pre-commit"
224+ @if ! command -v prek > /dev/null 2>&1 ; then \
225+ echo " prek not found. Install with: brew install prek" >&2 ; \
226+ exit 1; \
227+ fi
228+ prek install
224229
225230# Show help
226231help :
@@ -248,7 +253,8 @@ help:
248253 @echo " postgres-down - Stop test PostgreSQL container"
249254 @echo " e2e - Run Playwright E2E tests"
250255 @echo " vet - Run go vet"
251- @echo " lint - Run golangci-lint"
256+ @echo " lint - Run golangci-lint (auto-fix)"
257+ @echo " lint-ci - Run golangci-lint (no fix, for CI)"
252258 @echo " tidy - Tidy go.mod"
253259 @echo " "
254260 @echo " release - Release build for current platform"
0 commit comments