The applications tracker, leads inbox, email pipeline and capture userscript move here from web_server's backend, Python service and Vue app, as one Go binary that serves its own Vue SPA under /jobs/. - The Go services, resolvers and tests move over almost unchanged. - The three Claude calls are ported from Python to Go (internal/claude), with the same prompts, per-model request shaping and error messages. - There is no login: internal/auth asks the site backend's /auth/validate-admin with the visitor's cookies, and relays refreshed cookies back. - A Settings page replaces the admin-panel capture token card and adds the Microsoft sign-in link and a manual email sync. - The userscript is 2.0.0, at /jobs/, and migrates a saved API base. - Dockerfile, a standalone compose with Postgres, Makefile, and a Gitea CI workflow that tests and publishes the image. Co-Authored-By: Claude Opus 5.5 <[email protected]>
2.3 KiB
2.3 KiB
CLAUDE.md
Guidance for Claude Code in this repository. README.md has the full picture (routes, auth, deployment, cutover).
Commands
make check # go vet ./... && go test ./..., then a vite build of web/ into a temp dir
make generate # gqlgen, after editing internal/graph/schema/*.graphql
make dev # docker compose up --build: tracker + Postgres, seeded, AUTH_MODE=dev
cd web && npm run dev # SPA hot reload; proxies /jobs/api to localhost:8080
Architecture
One Go binary (cmd/jobtracker) that serves a GraphQL API, a few REST routes and the built Vue SPA, all under /jobs. It is deployed as one container inside the web_server stack, behind its nginx, on its Postgres.
- Auth is borrowed.
internal/authforwards cookies to the site backend's/auth/validate-admin. GraphQL is guarded only by@adminon every field.internal/graph/directives_test.gofails if a Query or Mutation field lacks it. The REST admin routes useauth.Require. - Claude calls live in
internal/claude. They are ported from the site's Python service and keep its prompts and per-model request shaping. There are three error kinds:*ReadError(safe to show the user),ErrNotConfigured, and a wrapped context error. Callers branch on them; keep that contract. The services take small interfaces (LeadScorer,EmailClassifier,PostingExtractor), so tests use fakes. - GraphQL types bind directly to GORM models (
gqlgen.yml).ID uintbinds throughgraphql.UintID. - The SPA is served from disk (
STATIC_DIR,/app/staticin the image) byhandlers.SPA. It is gin'sNoRoutehandler, so history-mode paths fall back toindex.html.
Conventions
- Comments explain why, not what. Preserve them; update them when behaviour changes.
- Resolver commentary lives inside function bodies. gqlgen strips or moves anything above a resolver's signature.
- Schema files use
#comments, not"""descriptions. - Models are soft-deleted except
ProcessedEmailandJobLead, whose dedup must see history, and the single-rowJobSearchProfile. - Job status: see "Things that are easy to get wrong" in README.md for the copies that must be edited by hand.
- The userscript: bump
@versioninweb/public/job-capture.user.json every edit.