11 lines
588 B
Markdown
11 lines
588 B
Markdown
# Commands Rules
|
|
|
|
- `commands/` is the only place state changes are implemented.
|
|
- Commands may change persistent `ImageDocument` state and transient `EditorState`.
|
|
- Commands must be deterministic, testable, and side-effect free.
|
|
- Do not import React, DOM UI, renderer/WebGL internals, storage, network, timers, or filesystem APIs.
|
|
- Validate payloads before applying changes.
|
|
- Preserve all `core/` and `editor/` invariants.
|
|
- Return the next `AppState`; do not mutate existing state objects in place.
|
|
- Every command needs a stable id, clear payload type, and focused responsibility.
|