Consider the following traditions...
Jabir reports[^3]: I said to Abu Ja’far [al-Baqir (AS)]: Why was Imam ‘Ali (AS) named Amir al-Mu’minin? He (AS) said: Allah is the One who named him, and this is how He revealed it in His Book: “When your Lord took from the children of Adam, from their loins, their descendants and made them bear witness over themselves, [He said to them,] Am I not your Lord (7:172) and isn’t Muhammad My Messenger and ‘Ali Amir al-mu’minin (the commander of the faithful)?
Imam al-Baqir (AS) is reported to have said: If the ignorant of this nation would know when Imam ‘Ali (AS) was named Amir al-mu’minin, they would not reject his guardianship and obedience. The reporter said: I asked him (AS): And when was Imam ‘Ali (AS) named Amir al-mu’minin? He replied: It was when Allah took the covenant with the progeny of Adam..
.[^5] Some traditions clearly tell us that the Holy Prophet (S) called Imam ‘Ali (AS) Amir al-mu’minin (AS) on different occasions during his life time.