KI-Konzil/_bmad-output/implementation-artifacts/stories/3-3-blueprint-parser-react-flow-json.md
copilot-swe-agent[bot] d4cfb34423 Changes before error encountered
Co-authored-by: Kenearos <86194771+Kenearos@users.noreply.github.com>
2026-03-12 15:00:09 +00:00

66 lines
2.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Story 3.3: Blueprint-Parser (React Flow → JSON)
<!-- 🏃 Prepared by BMAD SM Skill — Agent: Bob (Scrum Master) -->
<!-- Skill Command: /bmad-agent-bmm-sm → [CS] Context Story -->
Status: done
## Story
Als **System**,
möchte ich **eine `parseGraphToBlueprint()`-Funktion**,
so dass sie **den Canvas-State in ein valides Blueprint-JSON konvertiert**.
## Acceptance Criteria
1. Nodes + Edges → `CouncilBlueprint` mit `version`, `name`, `nodes[]`, `edges[]`
2. Bedingte Edge → `type: "conditional"` und `condition: "<label>"` im Edge-JSON
3. Lineare Edge → `type: "linear"` ohne `condition`-Feld
4. `version: 1` als Startwert
5. Tests: Alle drei Fälle (linear, conditional, gemischt)
## Tasks / Subtasks
- [x] Task 1: `utils/blueprint-parser.ts` implementieren (AC: 14)
- [x] Subtask 1.1: Nodes-Mapping: `id`, `label`, `systemPrompt`, `model`, `tools`, `position`
- [x] Subtask 1.2: Edges-Mapping: `id`, `source`, `target`, `type`, optional `condition`
- [x] Subtask 1.3: Rückgabe: `CouncilBlueprint` mit `version: 1`
- [x] Task 2: `types/council.ts``CouncilBlueprint`, `BlueprintNode`, `BlueprintEdge` (AC: 1)
- [x] Task 3: Vitest-Tests (AC: 15)
- [x] Subtask 3.1: Test lineares Blueprint
- [x] Subtask 3.2: Test bedingte Edge
- [x] Subtask 3.3: Test leeres Canvas (0 Nodes/Edges)
## Dev Notes
- `existingId?: string` Parameter für Updates (PUT vs POST)
- Tool-Mapping: `webSearch`, `pdfReader` (camelCase im Frontend, snake_case im Backend)
- `EdgeType = "linear" | "conditional"` als Union-Typ
### Project Structure Notes
- `frontend/app/utils/blueprint-parser.ts`
- `frontend/app/types/council.ts`
- `frontend/app/__tests__/blueprint-parser.test.ts`
### References
- [Source: _bmad-output/planning-artifacts/architecture.md#Blueprint-JSON-Schema]
## Dev Agent Record
### Agent Model Used
Amelia (💻 BMAD Dev Agent)
### Completion Notes List
- `position`-Feld wird mitgespeichert, damit Blueprint-Reload die Node-Positionen wiederherstellt.
- `existingId` ermöglicht `PUT`-Updates ohne neue ID-Generierung.
### File List
- `frontend/app/utils/blueprint-parser.ts`
- `frontend/app/types/council.ts`
- `frontend/app/__tests__/blueprint-parser.test.ts`
- `frontend/app/__tests__/types.test.ts`