Inspiration

Our team is deeply integrated with Atlassian products, with Bitbucket serving as our primary source control tool. We recognized this disruptive potential and leveraged AI to enhance our Atlassian plugin offerings, which are critical tools for our clients. However, the AI-assisted code review process we adopted was cumbersome. It required us to manually copy code diffs or new code snippets to external platforms like ChatGPT, conduct the review there, and then circle back to Bitbucket to post comments. This back-and-forth was not only inefficient but also prone to errors. To streamline this workflow, we developed a Forge plugin that seamlessly integrates AI-powered code reviews directly into Bitbucket, eliminating the need for manual toggling between platforms and significantly accelerating our code review process.

What it does

Our Forge plugin revolutionizes the code review process within Bitbucket by integrating AI-powered insights and automations. Here's how it enhances your workflow:

AI-Driven File Review: Within the pull request page, we provide a panel where users can select specific files for review. The AI performs an initial analysis based on a curated prompt, offering immediate insights.

Interactive Chat Interface: After the initial review, developers are presented with a chat interface. Here, they can tweak suggestions, ask for more context, or provide additional information. The AI responds accordingly, making the review process highly interactive and tailored to the developer's needs.

Seamless Comment Integration: AI-generated suggestions can be directly inserted as comments within the pull request, streamlining the review process and reducing manual effort.

Configurable Language Models: Administrators have the flexibility to choose the AI language model that best suits their needs. They can opt for running their own instance of OpenAI using Azure, or use the generally available OpenAI.com models.

Automated PR Features: Our plugin offers automated features that can be toggled on or off. These run when a pull request is created and are inserted as the first comment, providing an initial summary of the changes. These features include:

Explaining the Pull Request: Offers a detailed breakdown of what has changed in each file. Code Formatting Checks: Verifies that the code adheres to standard formatting guidelines. Changelog Verification: Checks for missing changelogs, ensuring that all changes are properly documented. By combining these features, our Forge plugin offers a comprehensive, efficient, and customizable code review experience right within Bitbucket.

How we built it

We engineered our Forge plugin using a robust and modular architecture to seamlessly integrate with Bitbucket. Here's a breakdown of our development process:

Framework and EAP: We utilized the Atlassian Forge framework for integration with Bitbucket. Fortunately, an Early Access Program (EAP) was available for some Bitbucket modules, which expedited our development.

Forge Modules: Our plugin is a composite of multiple Forge modules:

Custom UI: Leveraging our expertise in React, we created an interactive chat panel using Forge's Custom UI module. Events and Triggers: We employed the built-in Events and Trigger API to automate various features. Asynchronous Queue: To handle automation requests asynchronously, we used Forge's Async Queue module. UI Kit: The configuration page was built using Forge's UI Kit for a cohesive user experience.

Custom Job Server

To address Forge's limitations on function invocations and long response times from AI endpoints, we developed a custom job server written in Golang. This server handles the AI requests, while our Forge app polls the server to check the status of these requests. This architecture was deployed using Azure Web App Service, ensuring scalability and reliability.

Language Models:

OpenAI Endpoint: For general usage, we integrated with OpenAI's completion endpoint. Azure OpenAI: For more privacy-focused applications, we tested and supported Azure OpenAI endpoint connections via Azure Cloud.

Challenges we ran into

While we have extensive experience in developing for Atlassian Data Center, transitioning to Forge for cloud apps presented a unique set of challenges. The platform's limitations, particularly around function invocation runtime, required us to think creatively. To circumvent these limitations, we implemented an external job server as a workaround, adding a layer of complexity to our architecture.

Additionally, we encountered issues that we suspect are bugs within the Forge platform itself. These unexpected hurdles added to the learning curve and required us to invest additional time in troubleshooting and problem-solving.

Accomplishments that we're proud of

We take great pride in several key accomplishments during the development of this project. First, successfully creating an interactive chat panel using Forge's Custom UI module was a significant milestone for us. This feature enhances the user experience by making the code review process more interactive and engaging.

Second, we're proud of our ability to navigate Forge's ecosystem effectively. Identifying the right modules, like the Async Queue, and innovating with the idea of an external job server to bypass limitations, showcases our problem-solving skills.

Third, the fact that we've built a plugin that we ourselves will use is incredibly rewarding. It's not just a theoretical solution; it's a practical tool that will significantly improve our own workflow.

Lastly, we're excited and proud to submit our innovative solution to Codegeist Unleashed 2023. It's a testament to our hard work and the potential impact our plugin can have on improving developer experience.

What we learned

This project has been an invaluable learning experience for us. First and foremost, we deepened our understanding of Forge apps, gaining insights into its limitations, capabilities, and how it differs from Data Center apps. This has broadened our skill set for future endeavors.

Secondly, we expanded our knowledge in AI and prompt engineering. Exploring various APIs helped us grasp the full potential of what AI can offer, especially in the context of code reviews.

Additionally, we learned more about Azure, as we offer Azure OpenAI as an optional language model. This required us to become more familiar with Azure's services.

The creation of a custom job server was a great learning of basics of a job server. It challenged us come up with solutions to overcome platform limitations.

What's next for Advanced Code Intelligence

Our immediate focus is on refining our existing features. Given that this was a hackathon project, development was accelerated, and our first priority is to polish the current functionalities and fix any lingering bugs.

Looking ahead, we have several exciting features in the pipeline:

Collaborative Learning: We plan to implement a feature where the AI learns from the team's code and review comments over time. This will make the tool increasingly accurate and tailored to your team's specific needs.

Customizable Rulesets: We're working on allowing each developer or reviewer to set their own tone and adjust parameters. This will make the AI's suggestions more aligned with individual preferences and organizational standards.

Code Snippets: Another idea we're exploring is the ability to save useful code snippets directly from the review process, making it easier to reuse and share quality code.

By focusing on these areas, we aim to make Advanced Code Intelligence an even more comprehensive, efficient, and user-centric tool for code reviews.

Built With

+ 5 more
Share this project:

Updates