Scaffold the workspaces feature package via pnpm turbo gen feature (single Workspace entity, getWorkspace use case) and hand-wire the aggregators: bindAll dispatcher (web-next), core-api app router, and workspace deps. Release-please registration reverted per the root-only versioning policy (AGENTS.md, ADR-027 retrofit). Pinned @trpc/server to the repo-wide 11.16.0 resolution so instanceof TRPCError checks share one module instance. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016j8z4VHjedXDTjEDNg7qHK
43 lines
4.1 KiB
Markdown
43 lines
4.1 KiB
Markdown
# AGENTS.md — workspaces
|
|
|
|
Feature package scaffolded by `turbo gen feature`. Provides domain logic, repositories, use cases, controllers and the tRPC router for `Workspace`.
|
|
|
|
## Overview
|
|
|
|
`@repo/workspaces` owns: the `Workspace` domain model, feature-scoped errors, the `IWorkspaceRepository` interface, one use case (`getWorkspaceUseCase`), one controller, a real Payload-backed repository (stub body — fill in once the Payload collection is added), an in-memory mock repository, and the tRPC `workspacesRouter`.
|
|
|
|
## Layer responsibilities
|
|
|
|
| Layer | Key files |
|
|
| ---------------------------------- | ------------------------------------------------------------------------------------------------------ |
|
|
| **entities/models** | `workspace.ts` — `Workspace` Zod schema + type |
|
|
| **entities/errors** | `workspace.ts` (WorkspaceNotFoundError), `common.ts` (InputParseError) |
|
|
| **application/use-cases** | `get-workspace.use-case.ts` — factory function + exported schemas |
|
|
| **application/repositories** | `workspace.repository.interface.ts` — `IWorkspaceRepository` |
|
|
| **infrastructure/repositories** | `workspace.repository.ts` (real Payload-backed; stub body), `workspace.repository.mock.ts` (in-memory) |
|
|
| **interface-adapters/controllers** | `get-workspace.controller.ts` — one file per use case |
|
|
| **di** | `symbols.ts`, `module.ts`, `container.ts`, `bind-production.ts`, `bind-dev-seed.ts` |
|
|
| **integrations/api** | `procedures.ts` (workspacesProcedure), `router.ts` (workspacesRouter) |
|
|
|
|
## Public exports
|
|
|
|
| Subpath | Contents |
|
|
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
| `.` | `Workspace` type; `WorkspaceNotFoundError`, `InputParseError`; `getWorkspaceInputSchema`, `getWorkspaceOutputSchema`, `GetWorkspaceInput`, `GetWorkspaceOutput`, `IGetWorkspaceUseCase`; `IGetWorkspaceController` type alias; `WorkspacesRouter` type |
|
|
| `./api` | `workspacesRouter` (tRPC router) |
|
|
| `./di/bind-production` | `bindProductionWorkspaces(config, tracer, logger)` |
|
|
| `./di/bind-dev-seed` | `bindDevSeedWorkspaces(tracer, logger)` |
|
|
| `./ui` | (reserved — empty barrel) |
|
|
|
|
## Tests
|
|
|
|
```bash
|
|
pnpm test --filter @repo/workspaces
|
|
```
|
|
|
|
## What it must NOT import
|
|
|
|
- Any other feature package
|
|
- Any app package
|
|
- `@repo/core-api`, `@repo/core-cms`, `@repo/core-trpc`, `@repo/core-ui` directly; only `@repo/core-shared`
|