Split the job tracker out of web_server into its own app
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]>
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
# 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/auth` forwards cookies to the site backend's `/auth/validate-admin`. GraphQL is guarded only by `@admin` on every field. `internal/graph/directives_test.go` fails if a Query or Mutation field lacks it. The REST admin routes use `auth.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 uint` binds through `graphql.UintID`.
|
||||
- **The SPA is served from disk** (`STATIC_DIR`, `/app/static` in the image) by `handlers.SPA`. It is gin's `NoRoute` handler, so history-mode paths fall back to `index.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 `ProcessedEmail` and `JobLead`**, whose dedup must see history, and the single-row `JobSearchProfile`.
|
||||
- **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 `@version` in `web/public/job-capture.user.js` on every edit.
|
||||
Reference in New Issue
Block a user