R epo A gent: An LLM -Powered Open-Source Framework for Repository-level Code Documentation Generation (2024)

Abstract: Generative models have demonstrated considerable potential in software engineering, particularly in tasks such as code generation and debugging. However, their utilization in the domain of code documentation generation remains underexplored. To this end, we introduce RepoAgent, a large language model powered open-source framework aimed at proactively generating, maintaining, and updating code documentation. Through both qualitative and quantitative evaluations, we have validated the effectiveness of our approach, showing that RepoAgent excels in generating high-quality repository-level documentation. The code and results are publicly accessible at https://github.com/OpenBMB/RepoAgent.

## introduction developers typically spend approximately 58% of their time on program comprehension, and high-quality code documentation plays a significant role in reducing this time @xcite . highquality documentation significantly lowers the learning curve for new project members, thereby accelerating their contributions and fostering a vibrant open-source community through enhanced participation and collaboration. however, maintaining code documentation also consumes a considerable amount of time, money, and human labor @xcite , and not all projects have the resources or enthusiasm to prioritize documentation as their top concern. to alleviate the burden of maintaining code documentation, early attempts at automatic documentation generation aimed to provide descriptive summaries for source code @xcite @xcite , as illustrated in figure 1 . however, they still have significant limitations, particularly in the following aspects: (1) poor summarization. previous methods primarily focused on summarizing isolated code snippets, overlooking the dependencies of code within the broader repository-level context. the generated code summaries are overly abstract parameters: ## conclusion and discussion in this paper, we introduce repoagent, an open source framework designed to generate fine-grained repository-level code documentation, facilitating improved team collaboration. the experimental results suggest that repoagent is capable of generating and proactively maintaining high-quality documentation for the entire project. repoagent is expected to free developers from this tedious task, thereby improving their productivity and innovation potential. in future work, we consider how to effectively utilize this tool and explore ways to apply repoagent to a broader range of downstream applications in the future. to this end, we believe that chatting can serve as a natural tool for establishing a communication bridge between code and humans. currently, by employing our approach with retrieval-augmented generation, which combines code, documentation, and reference relationships, we have achieved preliminary results in what we called "chat with repo", which marks the advent of a novel coding paradigm.