From 69964abe2e434664f56d73594be088e06338b5da Mon Sep 17 00:00:00 2001 From: dtoro Date: Fri, 17 Jul 2026 23:09:47 +0200 Subject: [PATCH] chore: reconcile on-client path + add golangci-lint config (R13+R14) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit R13 — on-client path reconciliation: - AGENTS.md: 6 occurrences of /opt/homelab-context/ → /opt/homelab/ (sections 1, 2, 5, 7) - .agents/NOMOS.md: 2 occurrences of /opt/homelab-context/ → /opt/homelab/ - CLIENTS.md already used /opt/homelab/ — now consistent across all docs. The repo is still named 'homelab-context' (git remote), it just clones to /opt/homelab/ on enrolled clients per CLIENTS.md. R14 — golangci-lint/staticcheck/govulncheck tooling: - .golangci.yml (new): config enabling govet, staticcheck, ineffassign, unused, errcheck, gosimple, typecheck, misspell, revive. Excludes generated code (internal/httpapi/gen/, internal/db/sqlcgen/) and relaxes errcheck in test files. - Makefile: split 'lint' target into vet, golangci, govulncheck subtargets. Each checks if the tool is installed and prints install instructions if not. 'make lint' runs all three. - CI already had golangci-lint-action + govulncheck (both advisory); the action auto-discovers .golangci.yml. --- .agents/NOMOS.md | 4 +- .golangci.yml | 41 +++++++++++++++++++ AGENTS.md | 12 +++--- Makefile | 13 +++++- .../2026-07-17-codebase-review-and-cleanup.md | 4 +- 5 files changed, 62 insertions(+), 12 deletions(-) create mode 100644 .golangci.yml diff --git a/.agents/NOMOS.md b/.agents/NOMOS.md index 1c8d1a1..dc6b382 100644 --- a/.agents/NOMOS.md +++ b/.agents/NOMOS.md @@ -13,13 +13,13 @@ service itself. ## Source of truth -The homelab-context repo at `/opt/homelab-context/` is the single source of +The homelab-context repo at `/opt/homelab/` is the single source of truth for: - Fleet topology (`inventory.yaml`) - Agent behaviour and conventions - Everything in this file -When in doubt, check `/opt/homelab-context/` first, or query the Oikos API/MCP +When in doubt, check `/opt/homelab/` first, or query the Oikos API/MCP server directly (see [AGENTS.md](../AGENTS.md) §3-4) — the database is authoritative at runtime. diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..f074b7d --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,41 @@ +# golangci-lint configuration for Oikos +# Docs: https://golangci-lint.run/usage/configuration/ +run: + timeout: 5m + tests: true + +linters: + enable: + - govet # go vet + - staticcheck # advanced static analysis + - ineffassign # detect ineffectual assignments + - unused # find unused identifiers + - errcheck # check for unchecked errors + - gosimple # simplifications + - typecheck # standard type checking + - misspell # find commonly misspelled English words in comments + - revive # fast, configurable linter (replaces golint) + +linters-settings: + errcheck: + # Allow unchecked errors on common Close/Flush patterns (deferred cleanup) + exclude-functions: + - (io.Closer).Close + - (*os.File).Close + +issues: + # Exclude generated code + exclude-rules: + - path: _test\.go + linters: + - errcheck + - path: internal/httpapi/gen/ + linters: + - all + - path: internal/db/sqlcgen/ + linters: + - all + # Don't auto-exclude common patterns + exclude-use-default: false + max-issues-per-linter: 0 + max-same-issues: 0 diff --git a/AGENTS.md b/AGENTS.md index ec27319..8a47109 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,7 +1,7 @@ # AGENTS.md — orientation for any agent on a homelab client You are running on a machine that is part of the **hubris** homelab. The full -context is in this checkout at `/opt/homelab-context/`. This file is the entry +context is in this checkout at `/opt/homelab/`. This file is the entry point. Read it once at start, then keep working. - **New client?** Read [CLIENTS.md](CLIENTS.md) first. @@ -30,7 +30,7 @@ is archived at `archive/knowledge/` for historical reference. Run `hostname` (Linux) or `scutil --get LocalHostName` (macOS), then read: - /opt/homelab-context/inventory.yaml + /opt/homelab/inventory.yaml That file tells you your role, your peers, what's mounted, and what services you host. If it does not exist, this client was not enrolled — stop and tell @@ -39,13 +39,13 @@ the operator; see [CLIENTS.md](CLIENTS.md#enrollment) for the enrollment flow ## 2. The topology -- `/opt/homelab-context/inventory.yaml` — every host, LXC, VM, and workstation +- `/opt/homelab/inventory.yaml` — every host, LXC, VM, and workstation with their mesh addresses, roles, and service mappings. This is the seed file; at runtime the DB is authoritative (query via MCP `get_entity` or the REST API). -- `/opt/homelab-context/seeds/knowledge.yaml` — full narrative knowledge +- `/opt/homelab/seeds/knowledge.yaml` — full narrative knowledge (documents, investigations, runbooks). Counts are not hardcoded here; count them from the seed or query the DB. Ingested into the DB on deploy. -- `/opt/homelab-context/.agents/operations/commands.md` — the operator's cheatsheet +- `/opt/homelab/.agents/operations/commands.md` — the operator's cheatsheet for pct, caddy, DNS, and the Oikos command surface. ## 3. The MCP server @@ -179,7 +179,7 @@ The DB is the truth. The old wiki files are archived at `archive/knowledge/` ## 7. Communication mode -Read and apply `/opt/homelab-context/.agents/shared/caveman.md` (if present). It defines the lab's +Read and apply `/opt/homelab/.agents/shared/caveman.md` (if present). It defines the lab's terse-communication standard — drop filler, keep substance, use fragments. ## 8. Auto-setup mechanism diff --git a/Makefile b/Makefile index ada87ab..2f58b86 100644 --- a/Makefile +++ b/Makefile @@ -20,9 +20,18 @@ test-db: OIKOS_TEST_DATABASE_URL="postgres://oikos:$${OIKOS_DB_PASSWORD:-oikos_dev}@localhost:5432/oikos?sslmode=disable" \ $(GO) test -race -count=1 ./internal/db/ ./internal/httpapi/ ./internal/mcp/ -lint: +lint: vet golangci govulncheck + +vet: $(GO) vet ./... - @command -v golangci-lint >/dev/null 2>&1 && golangci-lint run || echo "golangci-lint not installed, skipping" + +golangci: + @command -v golangci-lint >/dev/null 2>&1 && golangci-lint run --config .golangci.yml || echo "golangci-lint not installed — see https://golangci-lint.run/usage/install/" + +govulncheck: + @command -v govulncheck >/dev/null 2>&1 && govulncheck ./... || echo "govulncheck not installed — run: go install golang.org/x/vuln/cmd/govulncheck@latest" + +.PHONY: lint vet golangci govulncheck generate: $(GO) run github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@v2.4.1 \ diff --git a/plans/2026-07-17-codebase-review-and-cleanup.md b/plans/2026-07-17-codebase-review-and-cleanup.md index 773d274..e7e3c73 100644 --- a/plans/2026-07-17-codebase-review-and-cleanup.md +++ b/plans/2026-07-17-codebase-review-and-cleanup.md @@ -434,8 +434,8 @@ the gitignore comment); `build` target ensures `bin/` exists; `clean` removes `b | R10 | Replace `` in `ActivityTimeline.svelte:103`; fix `state_referenced_locally` warnings | S | Low | ✅ done | | R11 | Add the 8 manually-registered `serve*` routes to `openapi.yaml` (or document the carve-out) | S | Low | ✅ done — documented the carve-out | | R12 | Add `docs/mbse/README.md` "Last verified" header + scheduled re-verification; normalize ADR 0013/0014 template | S | Low | -| R13 | Reconcile on-client path (`/opt/homelab/` vs `/opt/homelab-context/`) across AGENTS.md + CLIENTS.md | S | Low | -| R14 | Install `golangci-lint`/`staticcheck`/`govulncheck` locally + in CI | S | Low | +| R13 | Reconcile on-client path (`/opt/homelab/` vs `/opt/homelab-context/`) across AGENTS.md + CLIENTS.md | S | Low | ✅ done | +| R14 | Install `golangci-lint`/`staticcheck`/`govulncheck` locally + in CI | S | Low | ✅ done — `.golangci.yml` config + split Makefile targets | ## G. Verification