Chapter on the Reasons Behind Hajj
Man Lā Yaḥḍuruh al-Faqīh|Volume 2|Book 3|Chapter 1
وَ سُئِلَ اَلصَّادِقُ عَلَيْهِ اَلسَّلاَمُ: عَنْ قَوْلِ اَللَّهِ عَزَّ وَ جَلَّ: « سَوٰاءً اَلْعٰاكِفُ فِيهِ وَ اَلْبٰادِ » فَقَالَ «لَمْ يَكُنْ يَنْبَغِي أَنْ يُصْنَعَ عَلَى دُورِ مَكَّةَ أَبْوَابٌ لِأَنَّ لِلْحَاجِّ أَنْ يَنْزِلُوا مَعَهُمْ فِي دُورِهِمْ فِي سَاحَةِ اَلدَّارِ حَتَّى يَقْضُوا مَنَاسِكَهُمْ فَإِنَّ أَوَّلَ مَنْ جَعَلَ لِدُورِ مَكَّةَ أَبْوَاباً مُعَاوِيَةُ ».
And it is narrated: Imam Jafar ibn Muhammad Al-Sadiq عليه السلام was asked about the saying of Allah سبحانه وتعالى, the Mighty and Glorious: “...wherein the residents and the visitors are equal...” (Surah Al-Hajj 22:25). Imam عليه السلام replied: "It was not appropriate to construct doors on the houses of Mecca because the pilgrims had the right to stay with the residents in their courtyards until they completed their rituals. The first to place doors on the houses of Mecca was Muawiyah."
- Ṣaḥīḥ al-Faqīh