Add code generation for state transitions and actions