Trim comments to the non-obvious why
Test and deploy / test (push) Successful in 28s
Test and deploy / deploy (push) Successful in 31s

Drop narration, history and restated-code comments across the repo,
keep short ones for security boundaries, upstream quirks and ordering
constraints, and record the convention in CLAUDE.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-11-24 20:49:03 +00:00
co-authored by Claude Opus 5.5
parent effddd2794
commit 4530cb8dc4
222 changed files with 1173 additions and 5423 deletions
+10 -66
View File
@@ -1,39 +1,14 @@
# =============================================================================
# Makefile — one place for the commands that verify and run this repo.
#
# WHY THIS FILE EXISTS
# The stack is four toolchains (Go, Python, Node, Docker) and the command
# that checks each one used to live only in a gitignored notes file. `make
# check` is the single thing to run before pushing; .gitea/workflows/
# deploy.yaml runs the same backend and Python checks (in containers, since
# the Pi runner has no host toolchains) before it deploys.
#
# WHAT IT NEEDS ON THE HOST
# check-backend / generate Go (the version in backend/go.mod)
# check-python python3 with the venv module
# check-vue Node + `npm install` done in vue/
# check-compose / dev Docker with the compose plugin
# check-caddy Docker
# Nothing here installs a toolchain; a missing one fails that target only.
#
# Recipes are plain `cd dir && cmd` one-liners on purpose: each line runs in
# its own shell, so the directory change cannot leak into the next line.
# =============================================================================
# `make check` before pushing; `make help` lists targets. A missing toolchain
# fails only the targets that need it.
# `make` with no arguments prints the target list rather than running checks.
.DEFAULT_GOAL := help
# Overridable: `make check-python PYTHON=python3.12` to match the image.
PYTHON ?= python3
# The virtualenv for the Python checks. At the repo root rather than inside
# python/, because python/ is a docker build context and a venv there would be
# sent to the daemon on every build. Gitignored (/.venv/).
# At the root, not in python/, which is a docker build context.
VENV := .venv
# Written after a successful install. Being a file target that depends on both
# requirements files, it is what makes `check-python` re-install when either
# changes and skip the install otherwise.
# Re-installs only when a requirements file changes.
VENV_STAMP := $(VENV)/.installed
.PHONY: help check check-backend check-python check-vue check-compose check-caddy generate dev
@@ -49,17 +24,12 @@ help:
@echo " make generate regenerate the gqlgen GraphQL code after a schema edit"
@echo " make dev build and run the dev stack (http://localhost)"
# Run with `make -k check` to keep going past the first failing area.
check: check-backend check-python check-vue check-compose check-caddy
check-backend:
cd backend && go vet ./... && go test ./...
# requirements-dev.txt `-r`-includes requirements.txt, so one install covers
# the app's dependencies and pytest. The venv is recreated from scratch
# whenever a requirements file changes: upgrading in place would leave behind
# packages that were removed from the files, and the check would keep passing
# on a dependency the image no longer has.
# Recreated from scratch so packages dropped from the files don't linger.
$(VENV_STAMP): python/requirements.txt python/requirements-dev.txt
rm -rf $(VENV)
$(PYTHON) -m venv $(VENV)
@@ -70,11 +40,7 @@ $(VENV_STAMP): python/requirements.txt python/requirements-dev.txt
check-python: $(VENV_STAMP)
cd python && ../$(VENV)/bin/python -m pytest tests -q
# A Vite build is enough to catch a broken import or template; there is no
# test runner or linter for the frontend.
#
# The build goes to a temp directory that is removed afterwards (success or
# failure), so the check never leaves a vue/dist behind or overwrites one.
# Builds into a temp directory, so vue/dist is never touched.
check-vue:
@test -d vue/node_modules || { \
echo "check-vue: vue/node_modules/ is missing. Run: cd vue && npm install"; \
@@ -82,22 +48,9 @@ check-vue:
@out=$$(mktemp -d) && trap 'rm -rf "$$out"' EXIT && \
cd vue && npx vite build --outDir "$$out" --emptyOutDir
# Validates the compose files: YAML, schema, and that every ${VAR} they
# interpolate resolves to something usable.
#
# With a real .env present this is simply `docker compose config -q`.
#
# Without one (a CI checkout, a fresh clone) two things break, and
# `--env-file .env.example` fixes neither:
# - several services declare `env_file: ./.env`, and compose refuses to load
# the project if that file does not exist;
# - .env.example has blank values, and OBSIDIAN_DIR is used as a bind-mount
# source, where an empty string is a hard "invalid spec" error.
# So in that case the files are validated against a temporary PROJECT
# DIRECTORY holding a copy of .env.example as its .env, with a placeholder for
# OBSIDIAN_DIR. `config` only resolves paths, it does not need them to exist,
# so the build contexts not being under the temp directory is fine. Nothing is
# written to the repo, and a real .env is never created by accident.
# Without a .env, validates against a temp project dir holding .env.example
# (compose refuses a missing env_file, and a blank OBSIDIAN_DIR is an invalid
# bind mount). A real .env is never created.
check-compose:
@set -e; \
if [ -f .env ]; then \
@@ -113,21 +66,12 @@ check-compose:
echo "docker compose -f docker-compose.yml -f docker-compose.dev.yml config -q"; \
docker compose --project-directory "$$pd" -f docker-compose.yml -f docker-compose.dev.yml config -q
# The edge config is validated by the image build itself (the last RUN in
# caddy/Dockerfile runs `caddy validate` for the production and dev sites), so
# this is that build and nothing more. The deploy's `docker compose up
# --build` runs the same build, and a failure there stops before any
# container is replaced. The first build compiles Caddy with its plugins and
# takes a few minutes; later ones reuse that layer unless the Dockerfile
# changes.
# The image build runs `caddy validate` for both modes.
check-caddy:
docker build -q -t web_server-caddy:check caddy/
# Rewrites backend/graph/generated.go and graph/model/models_gen.go from
# graph/schema/*.graphql. Resolver bodies in *.resolvers.go are preserved.
generate:
cd backend && go run github.com/99designs/gqlgen generate
# Dev stack: http and https, seeded database, Vite hot reload behind Caddy.
dev:
docker compose -f docker-compose.yml -f docker-compose.dev.yml up --build