- Rename eslint-config → core-eslint, typescript-config → core-typescript in all docs (package map, AGENTS.md, overview.md, dependency-flow.md, etc.) - Document the five-tag model (app, feature, core, core-composition, tooling) — refinement of ADR-006's three-tag mention - Document core-trpc's core-composition tag (transitively reaches features through core-api's AppRouter type) - Note Turborepo boundaries as a second enforcement layer alongside ESLint - Add ADR-010 explaining the two-layer enforcement decision and five-tag refinement Files updated: - docs/architecture/overview.md: package map, enforcement layers, five-tag section - docs/architecture/dependency-flow.md: boundary rules, enforcement strategy - docs/architecture/vertical-feature-spec.md: package names, five-tag model - AGENTS.md: package map, boundary rules, commands - CLAUDE.md: tooling package names, quick-start command - packages/core-eslint/AGENTS.md: tag clarification - packages/core-typescript/AGENTS.md: tag clarification - packages/core-api/AGENTS.md: core-composition tag - packages/core-cms/AGENTS.md: core-composition tag - packages/core-trpc/AGENTS.md: core-composition tag + rationale - docs/decisions/adr-010-turbo-boundaries.md: new ADR Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
51 lines
1.6 KiB
Markdown
51 lines
1.6 KiB
Markdown
# AGENTS.md — core-api
|
|
|
|
**Tag:** core-composition
|
|
|
|
**Composition-only package** that aggregates feature tRPC routers into a single root `appRouter`. It does not define procedures; instead, it imports them from feature packages.
|
|
|
|
## Responsibilities
|
|
|
|
- **Compose tRPC appRouter** — merges feature routers into `t.router({ ... })`
|
|
- **Type export** — exports `AppRouter` type for frontend type safety
|
|
- **No procedure definitions** — all routers owned by their respective features (`@repo/auth`, `@repo/blog`, etc.)
|
|
- **No business logic** — purely structural assembly
|
|
|
|
## Allowed imports
|
|
|
|
- **`@repo/<feature>/api`** subpath exports only (to get tRPC routers)
|
|
- e.g., `import { authRouter } from "@repo/auth/api"`
|
|
- e.g., `import { blogRouter } from "@repo/blog/api"`
|
|
- e.g., `import { navigationRouter } from "@repo/navigation/api"`
|
|
- `@repo/core-shared/trpc/init` — for `t.router()` builder
|
|
|
|
## Must NOT import
|
|
|
|
- Any feature's root package or other subpaths (e.g., NOT `@repo/blog/di`, NOT `@repo/blog/entities`)
|
|
- Any app package
|
|
- `@repo/core-cms`, `@repo/core-trpc`, `@repo/core-ui`
|
|
|
|
## Public exports
|
|
|
|
From `package.json`:
|
|
- `.` — `appRouter` and `AppRouter` type
|
|
|
|
Example usage:
|
|
```typescript
|
|
import { appRouter, type AppRouter } from "@repo/core-api";
|
|
```
|
|
|
|
## Test conventions
|
|
|
|
- No unit tests (composition layer)
|
|
- Verify at app boot: `pnpm dev --filter @repo/web-next` succeeds and tRPC client fetches data
|
|
- Run router health check: `pnpm typecheck` confirms `AppRouter` type is valid
|
|
|
|
## Structure
|
|
|
|
```
|
|
src/
|
|
root.ts # t.router({ ... }) aggregating all feature routers
|
|
index.ts # re-exports appRouter + type
|
|
```
|