# Refactoring Roadmap Status of all items from the codebase audit. ## 🔴 Critical (Architectural Debt) ### 1. `src/stores/editor.ts` — was 2,505 lines **Status:** ✅ Done — extracted to `packages/core/src/editor/` (15 modules). App store is 570 lines, spreads `Editor` + adds file I/O, export, flash effects. ### 2. `src/composables/use-canvas-input.ts` — was 1,501 lines **Status:** ✅ Done — split into 5 modules in `packages/vue/src/input/` (types, geometry, pan-zoom, resize, auto-layout). Orchestrator: 815 lines. ### 3. State is fully mutable to all consumers **Status:** 🔜 Deferred — `shallowReadonly` + setter methods. Low priority since SDK composables now type against `Editor` not raw state. ## 🟡 Medium (Code Quality) ### 4. Fire-and-forget async calls — 10+ unhandled **Status:** 🔜 Deferred — needs `safeFire()` helper. ### 5. Module-level state in composables **Status:** 🔜 Deferred — `use-chat.ts` and `use-menu.ts` are app-specific, low urgency. ### 6. Bounding-box computation duplicated ~10 times **Status:** ✅ Done — `computeBounds()` added to geometry.ts. snap.ts deduplicated with `rotatedBBox()`. ### 7. "Node not found" guard repeated 44 times in tools **Status:** ✅ Partially done — `requireNode()` + `NodeNotFoundError` added to tools/schema.ts. Tool-by-tool adoption is incremental. ### 8. Barrel import overuse **Status:** 🔜 Deferred — gradual migration to subpath imports. ### 9. `kiwi-serialize.ts` misplaced **Status:** ✅ Done — moved to `packages/core/src/kiwi/kiwi-serialize.ts`. ### 10. `tools/stock-photo.ts` throws instead of returning `{ error }` **Status:** ✅ Already correct — exports use `return { error }`, throws are internal only. ## 🟢 Low Priority (Polish) ### 11. Large Vue components (8 over 300 lines) **Status:** 🔜 Deferred — split incrementally. ### 12. Icon import bloat **Status:** 🔜 Deferred. ### 13. Unscoped `