Browse Source
Phase 19: Type Refactoring - 2 plans created - 6 tasks total defined - Ready for executionhandoff-20260429-1057
4 changed files with 290 additions and 8 deletions
@ -0,0 +1,152 @@ |
|||||
|
--- |
||||
|
phase: 19-type-refactoring |
||||
|
plan: 01 |
||||
|
type: execute |
||||
|
--- |
||||
|
|
||||
|
<objective> |
||||
|
Extract node and annotation types from src/types/index.ts into focused domain files. |
||||
|
|
||||
|
Purpose: Improve maintainability by organizing the 364-line types file into smaller, domain-specific modules. |
||||
|
Output: New node.ts and annotation.ts files with re-exports from index.ts preserving backward compatibility. |
||||
|
</objective> |
||||
|
|
||||
|
<execution_context> |
||||
|
~/.claude/get-shit-done/workflows/execute-phase.md |
||||
|
~/.claude/get-shit-done/templates/summary.md |
||||
|
</execution_context> |
||||
|
|
||||
|
<context> |
||||
|
@.planning/PROJECT.md |
||||
|
@.planning/ROADMAP.md |
||||
|
@.planning/STATE.md |
||||
|
|
||||
|
**File being refactored:** |
||||
|
@src/types/index.ts |
||||
|
|
||||
|
**Prior phase establishing pattern:** |
||||
|
@.planning/phases/16-store-modularization/16-01-SUMMARY.md |
||||
|
|
||||
|
**Constraining decisions:** |
||||
|
- Phase 16: Store utilities extracted to src/store/utils/ with re-exports for backward compatibility |
||||
|
- Same pattern applies here: extract to domain files, re-export from index.ts |
||||
|
</context> |
||||
|
|
||||
|
<tasks> |
||||
|
|
||||
|
<task type="auto"> |
||||
|
<name>Task 1: Extract node types to nodes.ts</name> |
||||
|
<files>src/types/nodes.ts, src/types/index.ts</files> |
||||
|
<action> |
||||
|
Create src/types/nodes.ts containing all node-related types: |
||||
|
|
||||
|
**Types to move:** |
||||
|
- NodeType (union type) |
||||
|
- NodeStatus |
||||
|
- BaseNodeData |
||||
|
- ImageInputNodeData |
||||
|
- PromptNodeData |
||||
|
- NanoBananaNodeData |
||||
|
- GenerateVideoNodeData |
||||
|
- LLMGenerateNodeData |
||||
|
- SplitGridNodeData |
||||
|
- OutputNodeData |
||||
|
- WorkflowNodeData (union) |
||||
|
- WorkflowNode |
||||
|
- HandleType |
||||
|
- ModelInputDef |
||||
|
- ImageHistoryItem, CarouselImageItem, CarouselVideoItem |
||||
|
|
||||
|
**Dependencies to import:** |
||||
|
- Node from @xyflow/react |
||||
|
- AspectRatio, Resolution, ModelType from ./models (will exist after Plan 2) |
||||
|
- SelectedModel, ProviderType from ./providers (will exist after Plan 2) |
||||
|
- LLMProvider, LLMModelType from ./models (will exist after Plan 2) |
||||
|
- AnnotationShape from ./annotation |
||||
|
|
||||
|
**For now:** Import what's needed from index.ts itself temporarily (will be cleaned in Plan 2). Add required types inline or as temporary imports. |
||||
|
|
||||
|
**Pattern:** Export all types individually. Add JSDoc comments for major interfaces. |
||||
|
</action> |
||||
|
<verify>TypeScript compiles without errors: npx tsc --noEmit</verify> |
||||
|
<done>nodes.ts exists with all node-related types, index.ts re-exports them, no TypeScript errors</done> |
||||
|
</task> |
||||
|
|
||||
|
<task type="auto"> |
||||
|
<name>Task 2: Extract annotation types to annotation.ts</name> |
||||
|
<files>src/types/annotation.ts, src/types/index.ts</files> |
||||
|
<action> |
||||
|
Create src/types/annotation.ts containing all annotation-related types: |
||||
|
|
||||
|
**Types to move:** |
||||
|
- ShapeType |
||||
|
- BaseShape |
||||
|
- RectangleShape |
||||
|
- CircleShape |
||||
|
- ArrowShape |
||||
|
- FreehandShape |
||||
|
- TextShape |
||||
|
- AnnotationShape (union) |
||||
|
- AnnotationNodeData (move from nodes.ts or keep reference) |
||||
|
- ToolType |
||||
|
- ToolOptions |
||||
|
|
||||
|
**Pattern:** Export all types individually. These are self-contained with no external dependencies. |
||||
|
|
||||
|
Update index.ts to: |
||||
|
1. Import and re-export from ./annotation |
||||
|
2. Remove moved type definitions |
||||
|
</action> |
||||
|
<verify>TypeScript compiles without errors: npx tsc --noEmit</verify> |
||||
|
<done>annotation.ts exists with all annotation types, index.ts re-exports them, no TypeScript errors</done> |
||||
|
</task> |
||||
|
|
||||
|
<task type="auto"> |
||||
|
<name>Task 3: Update index.ts re-exports and verify all imports work</name> |
||||
|
<files>src/types/index.ts</files> |
||||
|
<action> |
||||
|
Ensure index.ts properly re-exports all types from the new files: |
||||
|
|
||||
|
```typescript |
||||
|
// Re-export all types from domain files |
||||
|
export * from './nodes'; |
||||
|
export * from './annotation'; |
||||
|
// Remaining types stay in index.ts (for now - moved in Plan 2) |
||||
|
``` |
||||
|
|
||||
|
Run full test suite to verify no import breakage: |
||||
|
```bash |
||||
|
npm test |
||||
|
``` |
||||
|
|
||||
|
Fix any import issues that arise from circular dependencies by: |
||||
|
1. Moving shared types to a common file if needed |
||||
|
2. Adjusting import order |
||||
|
</action> |
||||
|
<verify>npm test passes, no TypeScript errors</verify> |
||||
|
<done>All 51 import sites work correctly, tests pass, TypeScript compiles</done> |
||||
|
</task> |
||||
|
|
||||
|
</tasks> |
||||
|
|
||||
|
<verification> |
||||
|
Before declaring plan complete: |
||||
|
- [ ] `npx tsc --noEmit` passes |
||||
|
- [ ] `npm test` passes (all 180+ tests) |
||||
|
- [ ] src/types/nodes.ts exists with node types |
||||
|
- [ ] src/types/annotation.ts exists with annotation types |
||||
|
- [ ] index.ts re-exports all types for backward compatibility |
||||
|
- [ ] No circular dependency errors |
||||
|
</verification> |
||||
|
|
||||
|
<success_criteria> |
||||
|
- All tasks completed |
||||
|
- All verification checks pass |
||||
|
- Node types extracted to nodes.ts |
||||
|
- Annotation types extracted to annotation.ts |
||||
|
- Backward compatibility maintained (no changes to import sites) |
||||
|
</success_criteria> |
||||
|
|
||||
|
<output> |
||||
|
After completion, create `.planning/phases/19-type-refactoring/19-01-SUMMARY.md` |
||||
|
</output> |
||||
@ -0,0 +1,129 @@ |
|||||
|
--- |
||||
|
phase: 19-type-refactoring |
||||
|
plan: 02 |
||||
|
type: execute |
||||
|
--- |
||||
|
|
||||
|
<objective> |
||||
|
Extract remaining types (provider, workflow, API, model) and clean up index.ts to be a pure re-export hub. |
||||
|
|
||||
|
Purpose: Complete the types refactoring by organizing all remaining types into domain files. |
||||
|
Output: New providers.ts, workflow.ts, api.ts, models.ts files with index.ts as re-export hub only. |
||||
|
</objective> |
||||
|
|
||||
|
<execution_context> |
||||
|
~/.claude/get-shit-done/workflows/execute-phase.md |
||||
|
~/.claude/get-shit-done/templates/summary.md |
||||
|
</execution_context> |
||||
|
|
||||
|
<context> |
||||
|
@.planning/PROJECT.md |
||||
|
@.planning/ROADMAP.md |
||||
|
@.planning/STATE.md |
||||
|
|
||||
|
**Prior plan in this phase:** |
||||
|
@.planning/phases/19-type-refactoring/19-01-SUMMARY.md |
||||
|
|
||||
|
**Files being refactored:** |
||||
|
@src/types/index.ts |
||||
|
@src/types/nodes.ts |
||||
|
@src/types/annotation.ts |
||||
|
</context> |
||||
|
|
||||
|
<tasks> |
||||
|
|
||||
|
<task type="auto"> |
||||
|
<name>Task 1: Extract provider types to providers.ts</name> |
||||
|
<files>src/types/providers.ts, src/types/index.ts</files> |
||||
|
<action> |
||||
|
Create src/types/providers.ts containing: |
||||
|
|
||||
|
**Types to move:** |
||||
|
- ProviderType |
||||
|
- SelectedModel |
||||
|
- ProviderConfig |
||||
|
- ProviderSettings |
||||
|
- LLMProvider |
||||
|
- LLMModelType |
||||
|
|
||||
|
Update index.ts to re-export from ./providers. |
||||
|
</action> |
||||
|
<verify>npx tsc --noEmit</verify> |
||||
|
<done>providers.ts exists with all provider types, index.ts re-exports them</done> |
||||
|
</task> |
||||
|
|
||||
|
<task type="auto"> |
||||
|
<name>Task 2: Extract workflow and model types</name> |
||||
|
<files>src/types/workflow.ts, src/types/models.ts, src/types/index.ts</files> |
||||
|
<action> |
||||
|
Create src/types/workflow.ts containing: |
||||
|
- WorkflowEdge, WorkflowEdgeData |
||||
|
- WorkflowSaveConfig, WorkflowCostData |
||||
|
- NodeGroup, GroupColor |
||||
|
|
||||
|
Create src/types/models.ts containing: |
||||
|
- AspectRatio, Resolution, ModelType |
||||
|
- ModelInputDef (if not in nodes.ts) |
||||
|
|
||||
|
Update index.ts to re-export from both files. |
||||
|
</action> |
||||
|
<verify>npx tsc --noEmit</verify> |
||||
|
<done>workflow.ts and models.ts exist, index.ts re-exports them</done> |
||||
|
</task> |
||||
|
|
||||
|
<task type="auto"> |
||||
|
<name>Task 3: Extract API types and finalize index.ts</name> |
||||
|
<files>src/types/api.ts, src/types/index.ts</files> |
||||
|
<action> |
||||
|
Create src/types/api.ts containing: |
||||
|
- GenerateRequest, GenerateResponse |
||||
|
- LLMGenerateRequest, LLMGenerateResponse |
||||
|
|
||||
|
Finalize index.ts to be a pure re-export hub: |
||||
|
```typescript |
||||
|
// Domain re-exports |
||||
|
export * from './nodes'; |
||||
|
export * from './annotation'; |
||||
|
export * from './providers'; |
||||
|
export * from './workflow'; |
||||
|
export * from './models'; |
||||
|
export * from './api'; |
||||
|
export * from './quickstart'; |
||||
|
``` |
||||
|
|
||||
|
Fix any circular dependencies by: |
||||
|
1. Ensuring each domain file only imports from other domain files, not index.ts |
||||
|
2. Moving shared types to the most logical domain file |
||||
|
|
||||
|
Run full test suite to verify everything works. |
||||
|
</action> |
||||
|
<verify>npm test passes, npx tsc --noEmit passes</verify> |
||||
|
<done>All types extracted, index.ts is re-export only, all tests pass, Phase 19 complete</done> |
||||
|
</task> |
||||
|
|
||||
|
</tasks> |
||||
|
|
||||
|
<verification> |
||||
|
Before declaring plan complete: |
||||
|
- [ ] `npx tsc --noEmit` passes |
||||
|
- [ ] `npm test` passes (all 180+ tests) |
||||
|
- [ ] src/types/providers.ts exists |
||||
|
- [ ] src/types/workflow.ts exists |
||||
|
- [ ] src/types/models.ts exists |
||||
|
- [ ] src/types/api.ts exists |
||||
|
- [ ] index.ts contains only re-exports (no type definitions) |
||||
|
- [ ] No circular dependency errors |
||||
|
</verification> |
||||
|
|
||||
|
<success_criteria> |
||||
|
- All tasks completed |
||||
|
- All verification checks pass |
||||
|
- All types organized into 7 domain files (nodes, annotation, providers, workflow, models, api, quickstart) |
||||
|
- index.ts is a pure re-export hub |
||||
|
- Backward compatibility maintained |
||||
|
- Phase 19 complete |
||||
|
</success_criteria> |
||||
|
|
||||
|
<output> |
||||
|
After completion, create `.planning/phases/19-type-refactoring/19-02-SUMMARY.md` |
||||
|
</output> |
||||
Loading…
Reference in new issue