As a codebase expands over time, its library dependencies can become outdated and require updates to maintain innovation and security. However, updating a library can introduce breaking changes in the code, necessitating significant developer time for maintenance. To address this, we introduce a framework of LLM agents to be used in combination with migration documentation to automatically recommend and apply code updates and ensure compatibility with new versions. Our solution can automatically localize updated library usages in live Java codebases and implement recommended fixes in a user-friendly manner. The system architecture consists of multiple key components: a Summary Agent, Control Agent, and Code Agent. To validate our approach, we apply the framework on an industrial use case by which we create three synthetic code repositories with major Upgrade changes and benchmark our approach against state-of-the-art methods. Results show that our approach not only performs upgrades using fewer tokens across all cases but also achieves a precision of 71.4%, highlighting its efficiency and effectiveness compared to state-of-the-art methods.
翻译:随着代码库的演进,其依赖库可能逐渐过时,需要更新以保持技术先进性与安全性。然而,库的更新可能引发代码中的破坏性变更,需要开发者投入大量维护时间。为解决此问题,我们提出一种结合迁移文档的LLM代理框架,能够自动推荐并实施代码更新,确保与新版本的兼容性。该方案可自动定位实际Java代码库中更新的库使用方式,并以用户友好的方式实施推荐修复。系统架构包含多个关键组件:摘要代理、控制代理与代码代理。为验证方法有效性,我们在工业用例中应用该框架,创建了三个包含重大升级变更的合成代码仓库,并与前沿方法进行基准测试。结果表明,我们的方法在所有案例中均能以更少的token完成升级,且达到71.4%的准确率,相较于现有前沿方法展现出更高的效率与有效性。