Browse Source

docs(19): create phase plan

Phase 19: Type Refactoring
- 2 plans created
- 6 tasks total defined
- Ready for execution
handoff-20260429-1057
shrimbly 6 months ago
parent
commit
7e6c39a7d5
  1. 11
      .planning/ROADMAP.md
  2. 6
      .planning/STATE.md
  3. 152
      .planning/phases/19-type-refactoring/19-01-PLAN.md
  4. 129
      .planning/phases/19-type-refactoring/19-02-PLAN.md

11
.planning/ROADMAP.md

@ -247,10 +247,11 @@ Plans:
**Goal**: Split types/index.ts into domain-specific type files (nodes, providers, workflow) **Goal**: Split types/index.ts into domain-specific type files (nodes, providers, workflow)
**Depends on**: Phase 18 **Depends on**: Phase 18
**Research**: Unlikely (internal refactoring) **Research**: Unlikely (internal refactoring)
**Plans**: TBD **Plans**: 2 plans
Plans: Plans:
- [ ] 19-01: TBD (run /gsd:plan-phase 19 to break down) - [ ] 19-01: Extract node and annotation types
- [ ] 19-02: Extract provider, workflow, API, and model types
#### Phase 20: Integration Tests #### Phase 20: Integration Tests
@ -276,7 +277,7 @@ Plans:
3. Generated images should be prepended with prompt details like generated videos 3. Generated images should be prepended with prompt details like generated videos
Plans: Plans:
- [ ] 21-01: Unify MD5 hashing for image deduplication - [x] 21-01: Unify MD5 hashing for image deduplication
#### Phase 22: Generate Node Dynamic Input Tests #### Phase 22: Generate Node Dynamic Input Tests
@ -335,8 +336,8 @@ Phases execute in numeric order: 1 → 2 → ... → 14 → 15 → 16 → 17 →
| 16. Store Modularization | v1.2 | 1/1 | Complete | 2026-01-12 | | 16. Store Modularization | v1.2 | 1/1 | Complete | 2026-01-12 |
| 17. Component Tests | v1.2 | 11/11 | Complete | 2026-01-13 | | 17. Component Tests | v1.2 | 11/11 | Complete | 2026-01-13 |
| 18. API Route Tests | v1.2 | 5/5 | Complete | 2026-01-13 | | 18. API Route Tests | v1.2 | 5/5 | Complete | 2026-01-13 |
| 19. Type Refactoring | v1.2 | 0/? | Not started | - | | 19. Type Refactoring | v1.2 | 0/2 | Planned | - |
| 20. Integration Tests | v1.2 | 0/? | Not started | - | | 20. Integration Tests | v1.2 | 0/? | Not started | - |
| 21. Fix Image Input & Deduplication | v1.2 | 0/1 | Planned | - | | 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 | | 22. Generate Node Dynamic Input Tests | v1.2 | 1/1 | Complete | 2026-01-13 |
| 23. Model Browser Improvements | v1.2 | 0/? | Not started | - | | 23. Model Browser Improvements | v1.2 | 0/? | Not started | - |

6
.planning/STATE.md

@ -9,10 +9,10 @@ See: .planning/PROJECT.md (updated 2026-01-09)
## Current Position ## Current Position
Phase: 22 of 23 (Generate Node Dynamic Input Tests) Phase: 21 of 23 (Fix Image Input & Deduplication)
Plan: 1 of 1 in current phase Plan: 1 of 1 in current phase
Status: Phase complete Status: Phase complete
Last activity: 2026-01-13 - Completed 22-01-PLAN.md Last activity: 2026-01-13 - Completed 21-01-PLAN.md
Progress: █████████░ 96% Progress: █████████░ 96%
@ -130,6 +130,6 @@ Recent decisions affecting current work:
## Session Continuity ## Session Continuity
Last session: 2026-01-13 Last session: 2026-01-13
Stopped at: Phase 22 complete Stopped at: Phase 21 complete
Resume file: None Resume file: None
Next action: Plan Phase 23 (run /gsd:plan-phase 23) Next action: Plan Phase 23 (run /gsd:plan-phase 23)

152
.planning/phases/19-type-refactoring/19-01-PLAN.md

@ -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>

129
.planning/phases/19-type-refactoring/19-02-PLAN.md

@ -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…
Cancel
Save