diff --git a/.planning/ROADMAP.md b/.planning/ROADMAP.md index b3bfab0b..10629061 100644 --- a/.planning/ROADMAP.md +++ b/.planning/ROADMAP.md @@ -250,7 +250,7 @@ Plans: **Plans**: 2 plans Plans: -- [ ] 19-01: Extract node and annotation types +- [x] 19-01: Extract node and annotation types - [ ] 19-02: Extract provider, workflow, API, and model types #### Phase 20: Integration Tests @@ -336,7 +336,7 @@ Phases execute in numeric order: 1 → 2 → ... → 14 → 15 → 16 → 17 → | 16. Store Modularization | v1.2 | 1/1 | Complete | 2026-01-12 | | 17. Component Tests | v1.2 | 11/11 | Complete | 2026-01-13 | | 18. API Route Tests | v1.2 | 5/5 | Complete | 2026-01-13 | -| 19. Type Refactoring | v1.2 | 0/2 | Planned | - | +| 19. Type Refactoring | v1.2 | 1/2 | In Progress | - | | 20. Integration Tests | v1.2 | 0/? | Not started | - | | 21. Fix Image Input & Deduplication | v1.2 | 1/1 | Complete | 2026-01-13 | | 22. Generate Node Dynamic Input Tests | v1.2 | 1/1 | Complete | 2026-01-13 | diff --git a/.planning/STATE.md b/.planning/STATE.md index fb24f75b..47dbf452 100644 --- a/.planning/STATE.md +++ b/.planning/STATE.md @@ -9,10 +9,10 @@ See: .planning/PROJECT.md (updated 2026-01-09) ## Current Position -Phase: 21 of 23 (Fix Image Input & Deduplication) -Plan: 1 of 1 in current phase -Status: Phase complete -Last activity: 2026-01-13 - Completed 21-01-PLAN.md +Phase: 19 of 23 (Type Refactoring) +Plan: 1 of 2 in current phase +Status: Plan 1 complete +Last activity: 2026-01-13 - Completed 19-01-PLAN.md Progress: █████████░ 96% @@ -46,8 +46,8 @@ Progress: █████████░ 96% | 22. Generate Node Dynamic Input Tests | 1/1 | 20 min | 20 min | **Recent Trend:** -- Last 5 plans: 7 min, 3 min, 22 min, 2 min, 20 min -- Trend: Test-focused phases have higher execution times due to verification cycles +- Last 5 plans: 3 min, 22 min, 2 min, 20 min, 8 min +- Trend: Type refactoring is faster than test phases ## Accumulated Context @@ -106,6 +106,8 @@ Recent decisions affecting current work: - Store utilities extracted to src/store/utils/ with re-exports for backward compatibility - Consolidated defaultNodeDimensions (was duplicated in addNode and createGroup) - localStorage mocking pattern for testing utility modules +- Type domain files live in src/types/*.ts with re-exports from index.ts +- BaseNodeData in annotation.ts to avoid circular imports (nodes.ts imports annotation.ts) ### Deferred Issues @@ -130,6 +132,6 @@ Recent decisions affecting current work: ## Session Continuity Last session: 2026-01-13 -Stopped at: Phase 21 complete +Stopped at: Phase 19-01 complete Resume file: None -Next action: Plan Phase 23 (run /gsd:plan-phase 23) +Next action: Execute Phase 19-02 (run /gsd:execute-plan .planning/phases/19-type-refactoring/19-02-PLAN.md) diff --git a/.planning/phases/19-type-refactoring/19-01-SUMMARY.md b/.planning/phases/19-type-refactoring/19-01-SUMMARY.md new file mode 100644 index 00000000..c9c3c03b --- /dev/null +++ b/.planning/phases/19-type-refactoring/19-01-SUMMARY.md @@ -0,0 +1,101 @@ +--- +phase: 19-type-refactoring +plan: 01 +subsystem: types +tags: [typescript, refactoring, types, modularization] + +# Dependency graph +requires: + - phase: 16-store-modularization + provides: Pattern for extracting to domain files with re-exports +provides: + - Node types module (src/types/nodes.ts) + - Annotation types module (src/types/annotation.ts) + - Re-exports from index.ts for backward compatibility +affects: [type-refactoring, future-type-extraction] + +# Tech tracking +tech-stack: + added: [] + patterns: + - Type extraction to domain-specific files + - Re-export pattern for backward compatibility + - Shared types in base module to avoid circular dependencies + +key-files: + created: + - src/types/annotation.ts + - src/types/nodes.ts + modified: + - src/types/index.ts + +key-decisions: + - "BaseNodeData defined in annotation.ts to avoid circular imports (nodes.ts imports from annotation.ts)" + - "Re-export all types from index.ts via export * from './module' for backward compatibility" + - "Combined Task 1-3 into single atomic commit due to circular type dependencies" + +patterns-established: + - "Type domain files live in src/types/*.ts" + - "Base types shared across domains go in the dependency-free module" + +issues-created: [] + +# Metrics +duration: 8min +completed: 2026-01-13 +--- + +# Phase 19 Plan 01: Extract Node and Annotation Types Summary + +**Extracted node and annotation types from index.ts into focused domain modules with re-exports preserving backward compatibility** + +## Performance + +- **Duration:** 8 min +- **Started:** 2026-01-13T20:38:00Z +- **Completed:** 2026-01-13T20:46:00Z +- **Tasks:** 3 +- **Files modified:** 3 (2 created, 1 modified) + +## Accomplishments + +- Created src/types/annotation.ts with BaseNodeData, shape types, AnnotationNodeData, and tool types (95 lines) +- Created src/types/nodes.ts with NodeType, NodeStatus, all *NodeData types, WorkflowNode, HandleType (180 lines) +- Updated src/types/index.ts to re-export from domain files, reduced from 365 to 126 lines (-239 lines) +- Maintained full backward compatibility for all import sites +- All 1142 tests pass + +## Task Commits + +Tasks were combined into a single atomic commit due to circular type dependencies: + +1. **Tasks 1-3: Extract types to domain files** - `f178b72` (feat) + +## Files Created/Modified + +- `src/types/annotation.ts` - BaseNodeData, ShapeType, all *Shape types, AnnotationShape, AnnotationNodeData, ToolType, ToolOptions +- `src/types/nodes.ts` - NodeType, NodeStatus, all *NodeData types (ImageInput, Prompt, NanoBanana, GenerateVideo, LLMGenerate, SplitGrid, Output), WorkflowNodeData union, WorkflowNode, HandleType, ModelInputDef, history item types +- `src/types/index.ts` - Re-exports from annotation.ts and nodes.ts, keeps model types, edge types, API types, config types, group types, provider types + +## Decisions Made + +- **BaseNodeData in annotation.ts:** To avoid circular dependencies (nodes.ts imports AnnotationNodeData from annotation.ts), BaseNodeData is defined in annotation.ts as the base module with no imports +- **Single atomic commit:** Tasks 1-3 are tightly coupled (nodes.ts imports from both annotation.ts and index.ts) - separating them would break compilation +- **Remaining types in index.ts:** Model types (AspectRatio, Resolution, ModelType), LLM types, Edge types, API types, Config types, Group types, Provider types remain in index.ts for Plan 2 + +## Deviations from Plan + +None - plan executed exactly as written + +## Issues Encountered + +- Pre-existing TypeScript errors in test files (missing mock properties for React Flow node types) - not related to this refactoring, tests still pass via Vitest + +## Next Phase Readiness + +- Pattern established for Plan 19-02 (extract provider, workflow, API, and model types) +- Ready to continue Phase 19 with remaining type extractions + +--- +*Phase: 19-type-refactoring* +*Completed: 2026-01-13*