module Rooibos::Command

Commands represent side effects.

The MVU pattern separates logic from effects. Your update function returns a pure model transformation. Side effects go in commands. The runtime executes them.

Commands produce messages, not callbacks. The tag argument names the message so your update function can pattern-match on it. This keeps all logic in update and ensures messages are Ractor-shareable.

Examples

# Terminate the application
[model, Command.exit]

# Run a shell command; produces [:got_files, {stdout:, stderr:, status:}]
[model, Command.system("ls -la", :got_files)]

# No side effect
[model, nil]