mirror of
https://github.com/PerpetualSoftware/pad.git
synced 2026-09-10 06:55:40 +00:00
062eef41b2
Grouped nice-to-haves called out in the pre-launch audit. 1. docs/architecture.md — new contributor-focused architecture doc. CLAUDE.md covers the same ground but is agent-oriented; this is the human companion. Covers backend layout, request flow, frontend / data model / CLI↔daemon model / agent integration / testing. 2. .env.example — extended to document every PAD_* variable in docs/deployment.md (core, database, real-time events, security, email). Existing Postgres/Redis + encryption secrets kept at the top; new variables grouped by concern with inline comments and safe defaults commented out. 3. .gitattributes — normalize LF line endings repo-wide, mark binary assets, and flag web/build + web/.svelte-kit as generated so they don't pollute GitHub linguist stats or PR diffs. 4. Makefile — CAUTION comment on `make install` noting that the `killall -9 pad` step is system-wide; anyone else's pad daemon on the same machine gets killed too. Designed for single-developer local setups; not for shared hosts. Parent: PLAN-644.
76 lines
2.1 KiB
Makefile
76 lines
2.1 KiB
Makefile
.PHONY: build test test-pg test-pg-down dev clean web dev-web serve restart lint install
|
|
|
|
BINARY=pad
|
|
BUILD_DIR=./cmd/pad
|
|
HOST?=127.0.0.1
|
|
INSTALL_DIR?=$(HOME)/.local/bin
|
|
|
|
VERSION ?= dev
|
|
COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null)
|
|
BUILD_TIME := $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
|
|
LDFLAGS := -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.buildTime=$(BUILD_TIME)
|
|
|
|
build: web
|
|
go build -ldflags "$(LDFLAGS)" -o $(BINARY) $(BUILD_DIR)
|
|
|
|
build-go:
|
|
go build -ldflags "$(LDFLAGS)" -o $(BINARY) $(BUILD_DIR)
|
|
|
|
install: build
|
|
@# Stop running server, install binary, clear stale pid.
|
|
@# CAUTION: `killall -9 pad` is SYSTEM-WIDE. If another user (or another
|
|
@# project on the same machine) is also running a `pad` process, it will
|
|
@# get killed too. Designed for single-developer local setups; don't run
|
|
@# `make install` on a shared host.
|
|
-killall -9 $(BINARY) 2>/dev/null
|
|
@sleep 1
|
|
@mkdir -p $(INSTALL_DIR)
|
|
cp -f $(BINARY) $(INSTALL_DIR)/$(BINARY)
|
|
rm -f ~/.pad/pad.pid
|
|
@echo "Installed $(BINARY) to $(INSTALL_DIR)/$(BINARY)"
|
|
@# Trigger server auto-start by running a command
|
|
@$(INSTALL_DIR)/$(BINARY) auth whoami 2>/dev/null || true
|
|
@echo "Server restarted."
|
|
|
|
test:
|
|
go test ./... -v
|
|
|
|
# Run tests against PostgreSQL (starts a container automatically).
|
|
# Uses port 5445 to avoid conflicts with any local PostgreSQL.
|
|
test-pg:
|
|
docker compose -f docker-compose.test.yml up -d --wait
|
|
PAD_TEST_POSTGRES_URL="postgres://pad:pad@localhost:5445/pad?sslmode=disable" go test ./... -v -count=1; \
|
|
EXIT_CODE=$$?; \
|
|
docker compose -f docker-compose.test.yml down -v; \
|
|
exit $$EXIT_CODE
|
|
|
|
test-pg-down:
|
|
docker compose -f docker-compose.test.yml down -v
|
|
|
|
dev: build-go
|
|
./$(BINARY) server start --host $(HOST)
|
|
|
|
serve: build
|
|
-./$(BINARY) server stop 2>/dev/null
|
|
@sleep 1
|
|
./$(BINARY) server start --host $(HOST)
|
|
|
|
restart: build-go
|
|
-./$(BINARY) server stop 2>/dev/null
|
|
@sleep 1
|
|
./$(BINARY) server start --host $(HOST)
|
|
|
|
web:
|
|
cd web && npm ci && npm run build
|
|
|
|
dev-web:
|
|
cd web && npm run dev
|
|
|
|
clean:
|
|
rm -f $(BINARY)
|
|
rm -rf web/build
|
|
go clean ./...
|
|
|
|
lint:
|
|
go vet ./...
|