Implement the 004-edit-combatant feature that adds the possibility to change a combatants name

This commit is contained in:
Lukas
2026-03-04 10:05:13 +01:00
parent aed234de7b
commit a9df826fef
16 changed files with 854 additions and 5 deletions

View File

@@ -0,0 +1,41 @@
# Quickstart: Edit Combatant
**Feature**: 004-edit-combatant
## Setup
```bash
pnpm install # Install dependencies (if needed)
pnpm check # Verify everything passes before starting
```
## Development
```bash
pnpm --filter web dev # Start dev server at localhost:5173
pnpm test:watch # Run tests in watch mode
```
## Implementation Order
1. **Domain event** — Add `CombatantUpdated` to `events.ts`
2. **Domain function** — Create `edit-combatant.ts` with pure `editCombatant` function
3. **Domain tests** — Create `edit-combatant.test.ts` with acceptance scenarios + invariants
4. **Domain exports** — Re-export from `index.ts`
5. **Application use case** — Create `edit-combatant-use-case.ts`
6. **Application exports** — Re-export from `index.ts`
7. **Hook** — Add `editCombatant` action to `useEncounter` hook
8. **UI** — Add inline name editing to `App.tsx`
## Verification
```bash
pnpm check # Must pass — format + lint + typecheck + test
```
## Key Files to Reference
- `packages/domain/src/add-combatant.ts` — Pattern to follow for domain function
- `packages/domain/src/remove-combatant.ts` — Pattern for "not found" error handling
- `packages/application/src/add-combatant-use-case.ts` — Pattern for use case
- `apps/web/src/hooks/use-encounter.ts` — Pattern for hook wiring