37 lines
1.4 KiB
Markdown
37 lines
1.4 KiB
Markdown
# AGENTS.md — core-shared
|
|
|
|
Generic, reusable primitives with **zero business knowledge**. This package is the foundation for all other packages and exports utilities, Payload field/hook definitions, and tRPC initialization.
|
|
|
|
## Responsibilities
|
|
|
|
- **Generic primitives** — environment helpers, date utilities, type guards
|
|
- **Payload utilities** — field definitions (slug, SEO), blocks (CTA), access controls (is-admin), hooks (slugify, publish timestamp)
|
|
- **tRPC platform** — `initTRPC.create()`, shared context factory, procedure builders
|
|
- **No business domain knowledge** — no awareness of articles, users, media, or any feature
|
|
|
|
## Must NOT import
|
|
|
|
- Any feature package (`@repo/auth`, `@repo/blog`, etc.)
|
|
- Any app package
|
|
- Framework-specific code (Next.js, TanStack React Query)
|
|
|
|
## Public exports
|
|
|
|
From `package.json`:
|
|
- `.` — all utilities, Payload exports, tRPC init
|
|
- `./payload` — Payload field/hook/block utilities only
|
|
- `./trpc/init` — tRPC initialization only
|
|
- `./trpc/context` — tRPC context factory only
|
|
|
|
## Test conventions
|
|
|
|
- Tests colocated: `src/lib/slug-field.ts` → `src/lib/slug-field.test.ts`
|
|
- Vitest environment: `node`
|
|
- Alias: `@/` resolves to `src/`
|
|
- Run: `pnpm test --filter @repo/core-shared`
|
|
|
|
Covered areas:
|
|
- Slug field generation + validation
|
|
- Payload hooks (publish-at timestamp, slugify-if-missing)
|
|
- Access control helpers
|