Files
CheapRetouch/specs/02-data-model.md
jared 1049057d7d Add Ralph Wiggum agent setup and project specifications
- Add project constitution with vision, principles, and autonomy settings
- Add 15 feature specifications covering full app scope
- Configure agent entry points (AGENTS.md, CLAUDE.md)
- Add build prompt and speckit command for spec creation
- Include comprehensive .gitignore for iOS development

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 23:19:41 -05:00

1.3 KiB

Data Model & Edit Operations

Description

Implement the non-destructive editing data model with operation stack for full undo/redo support.

Acceptance Criteria

  • EditOperation enum implemented with cases: .mask, .inpaint, .adjustment
  • MaskOperation struct with: id, toolType, maskData (compressed R8), timestamp
  • InpaintOperation struct with: id, maskOperationId, patchRadius, featherAmount, timestamp
  • ToolType enum with cases: .person, .object, .wire, .brush
  • Project model that holds:
    • Original image reference (PHAsset identifier or embedded Data)
    • Operation stack (array of EditOperation)
    • Current stack position for undo/redo
  • All models conform to Codable
  • Undo operation decrements stack position
  • Redo operation increments stack position
  • Project can be serialized to/from JSON
  • Unit tests for operation stack logic

Technical Notes

  • Original image is NEVER modified
  • Mask data should be compressed (R8 texture format)
  • Store PHAsset localIdentifier for Photos-sourced images
  • Store embedded image data for Files-imported images
  • Cached previews should set isExcludedFromBackup = true

Edge Cases

  • Undo at beginning of stack: no-op, return false
  • Redo at end of stack: no-op, return false
  • Empty operation stack: valid state, shows original image