The mailbox sync (Microsoft Graph and IMAP), its Claude classifier, the /email routes and the Settings page's email section are taken out while the pipeline is unused. The last commit with it is tagged email-pipeline-last; reverting this commit brings it back. The status rules the capture path shares (statusOrder, StatusAdvances, NormalizeStatus) move to job_status.go with their tests. ProcessedEmail stays in the migration, marked dormant, so its history survives for a restored pipeline. golang.org/x/oauth2 is no longer needed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
31 lines
2.4 KiB
Markdown
31 lines
2.4 KiB
Markdown
# 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`, `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`. `ProcessedEmail` is dormant: the email pipeline was removed (tag `email-pipeline-last`), but the table is still migrated so its history survives.
|
|
- **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.
|