docs(adr): rename ADR-012 — drop Lazar; update title + content + cross-refs

- Rename docs/decisions/adr-012-lazar-conformance.md → adr-012-feature-conventions.md
- Strip "Lazar", "Plan 8/9/10/11", "refactor-logs" refs from all ADRs,
  architecture docs, HTML explainers, and feature/core AGENTS.md files
- Update all incoming links in docs/, packages/*/AGENTS.md, HTML explainers

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-13 10:07:37 +02:00
parent 06da37f723
commit 841655573b
18 changed files with 420 additions and 435 deletions

View File

@@ -1,6 +1,6 @@
# AGENTS.md — media
Media upload collection (images, PDFs, etc.) and media-related use cases (get, list, delete). Provides the Media Payload collection and tRPC procedures for asset management. Full Clean Architecture scaffold added in Plan 8.
Media upload collection (images, PDFs, etc.) and media-related use cases (get, list, delete). Provides the Media Payload collection and tRPC procedures for asset management.
## Overview
@@ -8,18 +8,18 @@ Media upload collection (images, PDFs, etc.) and media-related use cases (get, l
## Layer responsibilities
| Layer | Key files |
|---|---|
| **entities/models** | `media.ts``mediaSchema` + `Media` type (filename, mimeType, filesize, url, etc.) |
| **entities/errors** | `media.ts` (MediaNotFoundError), `common.ts` (InputParseError) |
| **application/use-cases** | `get-media.use-case.ts`, `list-media.use-case.ts`, `delete-media.use-case.ts` — factory functions + exported schemas |
| **application/repositories** | `media.repository.interface.ts``IMediaRepository` |
| **infrastructure/repositories** | `media.repository.ts` (real Payload-backed), `media.repository.mock.ts` (in-memory) |
| **interface-adapters/controllers** | `get-media.controller.ts`, `list-media.controller.ts`, `delete-media.controller.ts` — one file per use case |
| **di** | `symbols.ts` (MEDIA_SYMBOLS), `module.ts`, `container.ts`, `bind-production.ts` |
| **integrations/api** | `procedures.ts` (mediaProcedure), `router.ts` (mediaRouter), `index.ts` |
| **integrations/cms** | `collections/media.ts` — Payload Media CollectionConfig |
| **ui** | `src/ui/index.ts` — placeholder (no query builders today) |
| Layer | Key files |
| ---------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| **entities/models** | `media.ts``mediaSchema` + `Media` type (filename, mimeType, filesize, url, etc.) |
| **entities/errors** | `media.ts` (MediaNotFoundError), `common.ts` (InputParseError) |
| **application/use-cases** | `get-media.use-case.ts`, `list-media.use-case.ts`, `delete-media.use-case.ts` — factory functions + exported schemas |
| **application/repositories** | `media.repository.interface.ts``IMediaRepository` |
| **infrastructure/repositories** | `media.repository.ts` (real Payload-backed), `media.repository.mock.ts` (in-memory) |
| **interface-adapters/controllers** | `get-media.controller.ts`, `list-media.controller.ts`, `delete-media.controller.ts` — one file per use case |
| **di** | `symbols.ts` (MEDIA_SYMBOLS), `module.ts`, `container.ts`, `bind-production.ts` |
| **integrations/api** | `procedures.ts` (mediaProcedure), `router.ts` (mediaRouter), `index.ts` |
| **integrations/cms** | `collections/media.ts` — Payload Media CollectionConfig |
| **ui** | `src/ui/index.ts` — placeholder (no query builders today) |
### DI symbols
@@ -27,14 +27,14 @@ Media upload collection (images, PDFs, etc.) and media-related use cases (get, l
## Public exports
| Subpath | Contents |
|---|---|
| `.` | `Media` type; `MediaNotFoundError`, `InputParseError`; `getMediaInputSchema`, `getMediaOutputSchema`, `listMediaInputSchema`, `listMediaOutputSchema`, `deleteMediaInputSchema`; all `XInput`/`XOutput` types + `IXUseCase` aliases; `IXController` type aliases; `MediaRouter` type |
| `./ui` | Placeholder — extend here when media gains React Query builders, never re-add to root |
| `./api` | `mediaRouter` (tRPC router) |
| `./cms` | Payload Media collection definition |
| `./di/bind-production` | `bindProductionMedia(ctx: BindProductionContext)` — swaps mock impls for real Payload-backed ones at app boot |
| `./di/bind-dev-seed` | `bindDevSeedMedia(ctx: BindContext)` — replaces the default empty mock with a populated one for dev / Storybook |
| Subpath | Contents |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `.` | `Media` type; `MediaNotFoundError`, `InputParseError`; `getMediaInputSchema`, `getMediaOutputSchema`, `listMediaInputSchema`, `listMediaOutputSchema`, `deleteMediaInputSchema`; all `XInput`/`XOutput` types + `IXUseCase` aliases; `IXController` type aliases; `MediaRouter` type |
| `./ui` | Placeholder — extend here when media gains React Query builders, never re-add to root |
| `./api` | `mediaRouter` (tRPC router) |
| `./cms` | Payload Media collection definition |
| `./di/bind-production` | `bindProductionMedia(ctx: BindProductionContext)` — swaps mock impls for real Payload-backed ones at app boot |
| `./di/bind-dev-seed` | `bindDevSeedMedia(ctx: BindContext)` — replaces the default empty mock with a populated one for dev / Storybook |
## Use-case + controller patterns
@@ -42,28 +42,28 @@ See `CLAUDE.md` Key Conventions and `docs/architecture/overview.md` for the cano
### Use cases
| Use case | Input schema | Output schema | Notes |
|---|---|---|---|
| `getMediaUseCase` | `getMediaInputSchema``{ id: string }` | `getMediaOutputSchema``= mediaSchema` | Throws `MediaNotFoundError` when id not found; ends with `getMediaOutputSchema.parse(media)` |
| `listMediaUseCase` | `listMediaInputSchema``{ limit?: int, offset?: int }` (strict) | `listMediaOutputSchema``z.array(mediaSchema)` | Returns paginated list; ends with `listMediaOutputSchema.parse(result)` |
| `deleteMediaUseCase` | `deleteMediaInputSchema``{ id: string }` | void (no `xOutputSchema`) | Throws `MediaNotFoundError` when id not found; no output schema |
| Use case | Input schema | Output schema | Notes |
| -------------------- | ----------------------------------------------------------------- | ------------------------------------------------ | -------------------------------------------------------------------------------------------- |
| `getMediaUseCase` | `getMediaInputSchema``{ id: string }` | `getMediaOutputSchema``= mediaSchema` | Throws `MediaNotFoundError` when id not found; ends with `getMediaOutputSchema.parse(media)` |
| `listMediaUseCase` | `listMediaInputSchema``{ limit?: int, offset?: int }` (strict) | `listMediaOutputSchema``z.array(mediaSchema)` | Returns paginated list; ends with `listMediaOutputSchema.parse(result)` |
| `deleteMediaUseCase` | `deleteMediaInputSchema``{ id: string }` | void (no `xOutputSchema`) | Throws `MediaNotFoundError` when id not found; no output schema |
### Controllers
| Controller | Presenter | Return type |
|---|---|---|
| `getMediaController` | identity presenter | `Promise<ReturnType<typeof presenter>>` (Media) |
| `listMediaController` | identity presenter | `Promise<ReturnType<typeof presenter>>` (Media[]) |
| `deleteMediaController` | none (void) | `Promise<void>` |
| Controller | Presenter | Return type |
| ----------------------- | ------------------ | ------------------------------------------------- |
| `getMediaController` | identity presenter | `Promise<ReturnType<typeof presenter>>` (Media) |
| `listMediaController` | identity presenter | `Promise<ReturnType<typeof presenter>>` (Media[]) |
| `deleteMediaController` | none (void) | `Promise<void>` |
All controllers accept `unknown` input and `safeParse` with the use-case's `xInputSchema`, throwing `InputParseError` on failure.
## Errors → tRPC codes
| Error class | tRPC code | Thrown by |
|---|---|---|
| `InputParseError` | `BAD_REQUEST` | controllers (safeParse failure) |
| `MediaNotFoundError` | `NOT_FOUND` | `getMediaUseCase`, `deleteMediaUseCase` |
| Error class | tRPC code | Thrown by |
| -------------------- | ------------- | --------------------------------------- |
| `InputParseError` | `BAD_REQUEST` | controllers (safeParse failure) |
| `MediaNotFoundError` | `NOT_FOUND` | `getMediaUseCase`, `deleteMediaUseCase` |
Defined in `src/integrations/api/procedures.ts` via `mediaProcedure = t.procedure.use(defineErrorMiddleware([...]))`.
@@ -138,10 +138,9 @@ src/
- Any other feature package (`@repo/auth`, `@repo/blog`, etc.)
- Any app package
- `@repo/core-api`, `@repo/core-cms`, `@repo/core-trpc`, `@repo/core-ui` directly; only `@repo/core-shared`
> Note: `@repo/core-trpc` and `@repo/core-ui` are optional packages scaffolded via `pnpm turbo gen core-package trpc` / `ui`. If not present, these constraints still apply to any future installation.
> Note: `@repo/core-trpc` and `@repo/core-ui` are optional packages scaffolded via `pnpm turbo gen core-package trpc` / `ui`. If not present, these constraints still apply to any future installation.
## Cross-links
- ADR-012 (`docs/decisions/adr-012-lazar-conformance.md`) — factory-style use cases, per-use-case controllers, file-naming conventions, full scaffold added in Plan 8
- ADR-012 (`docs/decisions/adr-012-feature-conventions.md`) — factory-style use cases, per-use-case controllers, file-naming conventions
- ADR-013 (`docs/decisions/adr-013-input-output-unification.md`) — schemas-in-use-case, presenter, `./ui` subpath, error middleware
- Refactor logs: `docs/superpowers/refactor-logs/2026-05-05-lazar-pattern-conformance.md` (Plan 8 — full scaffold), `docs/superpowers/refactor-logs/2026-05-06-input-output-unification.md` (Plan 9 — schemas + procedures)