Genesis 2:16 indicates the original direct command from God was to Adam alone, as not only is "the man [i.e. Adam]" the subject, but the verb is 2nd person masculine singular, as are all the references that state "you" in v.17 (whether part of the verb or an actual pronoun in the Hebrew). This was prior to Eve's creation (2:18, 21-23).
So when, in chapter 3, the serpent uses the plural "you," and Eve likewise replies with a plural "we," even in her paraphrase of the command in 3:3, we are left with three options:
- Eve was also, sometime after her creation, directly commanded by God (which command may have included not touching also, per 3:3).
- Eve was told by Adam they were not to eat it (and possibly adding not to touch it to keep as far as possible from temptation), passing the command of God on to her. This would still be viewed by her as a command from God to her, as a command from God can come via an intermediary (after all, every command from God in Scripture that one might consider applying to themselves today is at least by the one intermediary of the human author of Scripture, though possibly via a preacher, teacher, or otherwise).
- Eve became aware of the command to Adam by Adam's discussing it, and chose to take that command upon herself as well since she was his helper.
Whatever the case, she "owned" the original command (along with the addition of not touching it) personally, such that when confronted by the serpent, she acknowledged the need for obedience herself.
Personally, since Scripture does not declare God spoke directly to Eve, I lean toward #2. From a contextual perspective, Eve's addition to "not touch" in 3:3 (which was not noted in Gen 2:16) implies that her instructions did not come directly from God, as if that aspect had been part of the direct command (or a modified form of it later) to both her and Adam, one would think that God (and thus the text of Scripture) would have made that distinction more evident, as touching is different than eating. Indeed, if touching had been a command itself, then mentioning eating would have been superfluous (as one could not eat it without touching it). So this addition implies strongly to me that either Adam warned her himself, adding the caution of not touching or she inferred it herself as a protective measure. In either case, it is not likely she received that form of the command directly from God.
But additionally, if one takes into account the New Testament testimony on this, then #2 or #3 is most likely, as it was not Eve's eating of the fruit that caused sin and death to enter the world, but Adam's (Rom 5:12-14). This statement indicates that it was the man, Adam, who was directly commanded by God and thus who bore the primary responsibility to obey, for it was his disobedience that brought sin and death (albeit, by Eve's transgression of tempting him to eat, Gen 3:6, 1 Tim 2:14, which might have also been a transgression against Adam's command to not touch if he had so given her that).