Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .githooks/pre-commit

This file was deleted.

30 changes: 18 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ LDFLAGS := -X main.version=$(VERSION) \
LDFLAGS_RELEASE := $(LDFLAGS) -s -w
DESKTOP_DIST_DIR := dist/desktop

.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
.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

# Ensure go:embed has at least one file (no-op if frontend is built)
ensure-embed-dir:
Expand Down Expand Up @@ -168,8 +168,16 @@ e2e:
vet: ensure-embed-dir
go vet -tags fts5 ./...

# Lint Go code with project defaults
# Lint Go code and auto-fix where possible (local development)
lint: ensure-embed-dir
@if ! command -v golangci-lint >/dev/null 2>&1; then \
echo "golangci-lint not found. Install with: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.10.1" >&2; \
exit 1; \
fi
golangci-lint run --fix ./...

# Lint Go code without fixing (for CI)
lint-ci: ensure-embed-dir
@if ! command -v golangci-lint >/dev/null 2>&1; then \
echo "golangci-lint not found. Install with: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.10.1" >&2; \
exit 1; \
Expand Down Expand Up @@ -211,16 +219,13 @@ release-linux-amd64: frontend
-ldflags="$(LDFLAGS_RELEASE)" -trimpath \
-o dist/agentsview-linux-amd64 ./cmd/agentsview

# Install pre-commit hook, resolving the hooks directory via git so
# this works in both normal repos and linked worktrees
# Install pre-commit hooks via prek
install-hooks:
@hooks_rel=$$(git rev-parse --git-path hooks) && \
hooks_dir=$$(cd "$$(dirname "$$hooks_rel")" && echo "$$PWD/$$(basename "$$hooks_rel")") && \
git config --local core.hooksPath "$$hooks_dir" && \
mkdir -p "$$hooks_dir" && \
cp .githooks/pre-commit "$$hooks_dir/pre-commit" && \
chmod +x "$$hooks_dir/pre-commit" && \
echo "Installed pre-commit hook to $$hooks_dir/pre-commit"
@if ! command -v prek >/dev/null 2>&1; then \
echo "prek not found. Install with: brew install prek" >&2; \
exit 1; \
fi
prek install -f

# Show help
help:
Expand Down Expand Up @@ -248,7 +253,8 @@ help:
@echo " postgres-down - Stop test PostgreSQL container"
@echo " e2e - Run Playwright E2E tests"
@echo " vet - Run go vet"
@echo " lint - Run golangci-lint"
@echo " lint - Run golangci-lint (auto-fix)"
@echo " lint-ci - Run golangci-lint (no fix, for CI)"
@echo " tidy - Tidy go.mod"
@echo ""
@echo " release - Release build for current platform"
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,16 @@ make dev # run Go server in dev mode
make frontend-dev # run Vite dev server (use alongside make dev)
make desktop-dev # run Tauri desktop app in dev mode
make test # Go tests (CGO_ENABLED=1 -tags fts5)
make lint # golangci-lint
make lint # golangci-lint (auto-fix)
make e2e # Playwright E2E tests
make install-hooks # install pre-commit hooks via prek
```

Pre-commit hooks are managed with [prek](https://github.com/j178/prek).
Run `brew install prek && make install-hooks` after cloning. The hook
runs `make lint` on every commit, auto-fixing formatting issues. If the
hook rewrites files, re-stage and re-commit.

## Desktop Development

The desktop app is a Tauri wrapper under `desktop/`. It launches
Expand Down
12 changes: 12 additions & 0 deletions prek.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
minimum_prek_version = "0.3.6"

[[repos]]
repo = "local"

[[repos.hooks]]
id = "golangci-lint"
name = "golangci-lint"
language = "system"
entry = "make lint"
pass_filenames = false
always_run = true