DEV Community

Cover image for (Code Alignment Assistant) Passenger gains GPT-4 accuracy and GitHub App Integration

(Code Alignment Assistant) Passenger gains GPT-4 accuracy and GitHub App Integration

Pigeon Progress!

Just a quick refresher on my thoughts: I'm convinced that Passenger has the potential to transform our development approach. By enhancing BDD with AI and enabling AI to evaluate our code against the desired solution directly from our issue tracker (in this case, GitHub), we can gain unprecedented insights. This feedback loop will not only alert us to errors but also offer improvement suggestions. It's about streamlining our processes, shedding unnecessary formalities, and accelerating our pace. Most importantly, it underscores the notion of empowering humans in the development process, rather than replacing them with AI. It's a game-changer, putting humans at the forefront of innovation.

Security improvements

To prepare Passenger for enterprise-level deployment and launch, I've developed a GitHub app. This can be seamlessly integrated into your individual GitHub repositories or an entire organization. The beauty of this is that it offers fine-tuned permissions, ensuring Passenger access only what's necessary. No more reliance on Personal access tokens or individual developers; you can now grant permissions organization-wide. And guess what? We're gearing up for the next big thing - Actions! By doing all of this work we addressed a significant security concern by eliminating the need for personal access tokens.

Simply install the GitHub App (note: it's still in private beta) and set up the Passenger CLI. Input your environment variables, and you're all set to enjoy helpful pigeons!

Here is what the GitHub App description has to say: (feel free to skip if you understand what Passenger is already.)

Have you ever meticulously coded a solution, only to discover it wasn't addressing the core issue? That's where Passenger comes in.

Passenger is a Code-Alignment Assistant (CAA) the first in its class, crafted with the belief in a harmonious co-working future between AI and developers. Our tool enhances development workflows, ensuring code consistency with project issues and fostering a collaborative environment where AI and human intelligence complement each other.

Passenger establishes a bridge between GitHub issues and your codebase, providing a robust tool for developers to validate that their work aligns with documented requirements and discussions. It offers the ability to compare the current state of your source code, staged changes, or pull requests against the details outlined in GitHub issues. This ensures a clear and accurate code-to-issue alignment, aiding in maintaining consistency and adherence to project specifications.

Permissions
Read access to code, discussions, issues, metadata, and pull requests

Demo time!

Im going to let the shell do the talking a moment.
coo-cart.js, it's the wrong solution on purpose

let cart = [];

function addToCart(productId, productName, productPrice) {
  let productInCart = cart.find((product) => product.id === productId);

  if (productInCart) {
    productInCart.quantity += 1;
  } else {
    cart.push({
      id: productId,
      name: productName,
      price: productPrice,
      quantity: 1,
    });
  }

  renderCart();
}

function renderCart() {
  const cartItemsElement = document.getElementById("cartItems");
  cartItemsElement.innerHTML = "";

  let total = 0;

  for (let product of cart) {
    const listItem = document.createElement("li");
    listItem.textContent = `${product.name} (x${product.quantity}) - $${
      product.price * product.quantity
    }`;
    cartItemsElement.appendChild(listItem);

    total += product.price * product.quantity;
  }

  document.getElementById("totalPrice").textContent = total;
}
Enter fullscreen mode Exit fullscreen mode
# Report on issue 1 from our github repo which has the Github App installed.
passenger score 1 ./docs/sample/src/coo-cart.js
Enter fullscreen mode Exit fullscreen mode
GithubConnector
adam-cyclones/passenger

      ░░                                                                      
      ░░████░░                                                                
        ██▒▒▓▓                                                                
        ▓▓▒▒██                                                                
      ▒▒▒▒░░░░▒▒                                                              
      ▓▓░░░░    ██░░░░                                                        
      ▒▒░░░░░░░░░░▒▒▓▓██░░                                                    
        ▓▓  ░░░░▓▓▓▓▓▓▓▓▓▓                                                    
        ░░▒▒▓▓▒▒                                                              
          ░░▒▒    ░░                                                          
          ░░░░          Cooeee! Percy is working please remain calm..                             

Issue recieved... #1 "Add Customisable Pigeon Animations for Nest Notifications" (fetched from live)
Converting issue to cucumber format...
The cucumber...
""" feature
 Feature: Customizable Pigeon Animations for Nest Notifications

Background: As a user of PigeonTasks app, 
  I want to customize pigeon animations for Nest Notifications, 
  So that I can enhance my user experience and add personalized touches to the app.

Scenario: Selecting Pigeon Animation from the Library 
  Given there is a selection of pigeon-themed animations
  When I go to select an animation for my notifications
  Then I should see a range of pigeon animations (from a dancing pigeon to one in themed costumes)

Scenario: Personalizing Settings for Pigeon Animations
  Given there is 'Personalized Settings' option
  When I select specific animations for tasks coming from certain friends or for tasks with certain tags/labels
  Then those specific animations should be set according to my preference

Scenario: Previewing Pigeon Animation
  Given there is an option to preview the animation before setting it 
  When I select an animation from the library
  Then I should be able to preview it within the app

Scenario: Checking Performance post Animation Implementation 
  Given there are new pigeon animations additions
  When I use the PigeonTasks app 
  Then the app's performance should not be hindered or cause lag when notifications pop up 
"""
Comparing... './docs/sample/src/coo-cart.js'
Generating report...
{
  "accuracy": 0,
  "analysis": "The provided source code is not related to the described issue. The code is about product shopping cart operations like adding to cart and rendering the cart, which doesn't pertain to the feature described about customizable pigeon animations for Nest Notifications in a task application. Therefore, the accuracy of the source code to address the issue is 0%."
}
Enter fullscreen mode Exit fullscreen mode

This is now using Chat GPT 4 and that took care of the bugs and allows for much better reports!

How would I use this? Whats next?

Im really excited to start caching some of the responses, speeding it up, improving it and maybe even adding a UI who knows, a SASS, a Pipeline? You can hope to have this as part of your test suite locally as you develop and also in a PR as a check that must pass a threshold.

Percy and Passenger away!

Top comments (0)