Implement Tefter per SPEC.md: NV-style notes with server, sync, PWA, desktop

- frontend/: Svelte 4 + TS + Vite app — omnibar (search-and-create), ranked
  diacritic-insensitive filtering, CodeMirror 6 markdown editor with 400ms
  autosave, marked+DOMPurify preview with [[wiki-links]], tag filter, undo
  toast, light/dark, narrow-screen stacked layout, IndexedDB store, pull-then-
  push sync engine with conflict handling, versioned cache-first service
  worker + manifest (installable PWA)
- server/: tefterd — Go stdlib HTTP + modernc.org/sqlite, /api/v1 sync API
  (changes/batch/health/import), SHA-256 hashed bearer token, LWW-with-
  conflict-copies push rules, subcommands: init, token rotate, import
  simplenote, compact, backup (VACUUM INTO); embeds the frontend bundle
- desktop/: Wails v2 shell — single instance, hide-to-tray (fyne systray),
  global Ctrl+Shift+Space hotkey, quit-on-close flag
- Simplenote import (CLI + web upload), idempotent via source_id dedupe;
  verified against a real 242-note export
- Makefile (frontend/server/server-all/desktop/test), GitHub release workflow,
  README with systemd/Caddy/backup docs

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-12 07:16:01 +02:00
commit 175c89e400
54 changed files with 7229 additions and 0 deletions

43
Makefile Normal file
View File

@@ -0,0 +1,43 @@
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
LDFLAGS = -s -w -X main.Version=$(VERSION)
DIST = build
.PHONY: all frontend server server-all desktop test clean dev
all: server
frontend:
cd frontend && npm install --no-audit --no-fund && TEFTER_VERSION=$(VERSION) npx vite build
# go:embed cannot reach outside the module dir, so the bundle is copied in.
server/webdist/dist: frontend
rm -rf server/webdist/dist
cp -r frontend/dist server/webdist/dist
touch server/webdist/dist/.gitkeep
server: server/webdist/dist
cd server && CGO_ENABLED=0 go build -trimpath -ldflags '$(LDFLAGS)' -o ../$(DIST)/tefterd .
server-all: server/webdist/dist
mkdir -p $(DIST)
cd server && for target in linux/amd64 linux/arm64 darwin/arm64 windows/amd64; do \
os=$${target%/*}; arch=$${target#*/}; ext=; [ $$os = windows ] && ext=.exe; \
echo "building tefterd-$$os-$$arch"; \
CGO_ENABLED=0 GOOS=$$os GOARCH=$$arch go build -trimpath -ldflags '$(LDFLAGS)' \
-o ../$(DIST)/tefterd-$$os-$$arch$$ext . || exit 1; \
done
desktop: server/webdist/dist
rm -rf desktop/frontend/dist
mkdir -p desktop/frontend
cp -r frontend/dist desktop/frontend/dist
cd desktop && wails build -ldflags '-X main.Version=$(VERSION)'
test:
cd server && go vet ./... && TEFTER_REAL_EXPORT=$(CURDIR)/notes.zip go test ./...
dev:
cd frontend && npx vite
clean:
rm -rf $(DIST) frontend/dist server/webdist/dist desktop/frontend/dist desktop/build/bin