As software engineering teams and projects scale, a common problem larger organizations can find themselves in is deciphering the “who’s who” of a codebase. This problem only compounds itself if large mono-repos are in use or multiple teams interact in the same space. Developers may find themselves asking “Who do I ask for a review on this? What team owns this part of the code base? Who do I ask for help?”
On the receiving end of this, you may find yourself getting asked questions on things you haven’t been involved in for years. Or you may be missing critical notifications on pieces of code you maintain or your team maintains. Or even worse, there may be cross team miscommunications that cause problems for the code you own.
As teams grow and codebases expand, before too long, it can be very easy to lose the thread on who owns what piece of “knowledge” across your engineering org. This lost context can slow down development, hinder open collaboration, and slowly erode the engineering culture of an engineering organization.
But what if there was a way to automate code ownership, streamline collaboration, and reduce this knowledge debt? Today, the OpenSauced team is very excited to introduce the Pizza CLI, a powerful command-line tool designed to help maintainers, teams, and organizations manage their engineering “ownership” culture and derive insights right on the command line.
Introducing the Pizza CLI
The Pizza CLI is our solution to the challenges of lost context and asking “Who’s who?” Born from discussions with industry experts like Bdougie and Kelsey Hightower, inspired by robust tools used by hyperscale tech companies across the industry, the Pizza CLI empowers teams to automate code ownership and enhance cross org collaboration directly from the command line.
CODEOWNERS Generation: Easily generate GitHub-style CODEOWNERS or Google-style OWNERS files, granularly mapping out who owns which parts of your codebase based on git history, number of lines touched, and current activity. These owner files can then be used in GitHub CODEOWNERS automation or as part of more robust CI/CD.
Attribution Configuration: Use a simple YAML configuration to map commit emails to GitHub usernames and teams, ensuring accurate ownership assignments and easy management of entities within your engineering org.
OpenSauced Integration: Seamlessly connect with OpenSauced to create Contributor Insights pages and metrics, helping you visualize and understand your project's contributor and owner landscape.
Enhanced collaboration for large teams
By clearly defining code ownership in a granular manner and integrating seamlessly with GitHub CODEOWNERS functionality, the Pizza CLI helps you:
Improve Efficiency: Developers know exactly who to reach out to for code reviews or questions, reducing delays, miscommunications, and team misalignments.
Enhance Collaboration: Ownership transparency creates a culture of shared responsibility and teamwork, further enhancing open “inner-source” between teams and developers.
Streamline Onboarding: New team members can quickly identify code owners, making it easier for them to ramp up and contribute confidently. Oftentimes, this can be automated through GitHub’s integration with CODEOWNER files through automatic PR review requests and notifications.
Getting Started with Pizza CLI
Installation
brew install open-sauced/tap/pizza
We offer a number of flexible options for installing the Pizza CLI onto your system (including Homebrew, NPM, Docker, and more). Check out the docs in the repository for a full rundown of the ways you can install this tool.
Validate your install
Check to make sure you can run the Pizza CLI:
pizza version
This will print out the version you have installed. Successfully running this in your terminal means you have successfully installed the CLI!
Generate a config
Before you can start generating codeowner files, you’ll need a YAML configuration that attributes git commit emails with GitHub user logins. You can generate a config through the ”pizza generate config” command:
pizza generate config /path/to/your/git/repo -i
The “-i” flag tells the Pizza CLI to use “interactive” mode. This iterates through the git ref-log and looks at commits and who authored them. It will then ask you to attribute those commit emails to individuals on your team:
Once you’ve finished generating your config, you’ll see that a .sauced.yaml
file is now in your git repo where you originally pointed the pizza command to. It’s been populated with the associated logins and emails that can be used to attribute changes in the repository to individual owners.
We encourage you to commit this file to your repository as a core piece of configuration “infrastructure” denoting what individuals have what attributions associated with them. Alternatively, if exposing commit emails in the config is not acceptable, you may choose to add it to a private secret store and pull it down manually to make code attributions for individuals on your teams.
You can also attribute GitHub teams to long lists of emails in your YAML configuration:
attribution:
# Keys may also be GitHub team names.
open-sauced/engineering:
- john@opensauced.pizza
- other-user@email.com
- other-user@no-reply.github.com
This way, multiple people can be associated to a single team within your configuration and will get the same attribution to anyone who is a code owner for those files. In other words, this is a powerful way to compose your teams and manage ownership across a whole team of engineers.
Generate a CODEOWNERS file
Now that you have a config, you can generate a CODEOWNERS file:
pizza generate codeowners /path/to/your/git/repo
This will read the .sauced.yaml
configuration file that you generated in your repo to know which git commit emails are associated with GitHub logins or teams.
The codeowners generation iterates the git-ref log and looks at the number of lines touched and the frequency of updates from individuals. It will find the top 3 codeowners per file who’ve done the most work within the configured time range (note: you can use the –range flag to change how far back to look in the git ref-log!)
We’re very excited to be bringing this tool to you! Knowing who owns what and how to get help from other teams can improve your workflow and minimize bottlenecks. Using tools that help you do that, can make it easier to connect with people when it matters most.
Be sure to check out the open source Pizza CLI repository for a full rundown of everything that’s possible with the Pizza CLI. And feel free to ask any questions or give us feedback in the GitHub issues!!
As always, stay saucy!
Top comments (3)
This could be super useful to folks who are participating in Hacktoberfest for the first time as well.
We're a small team, but I love that we leverage CODEOWNERS. It auto assigns PR reviewers for one. It's a small thing, but it adds up if you have to do it manually all the time. That said it's beneficial for any size team.
This reminds me of a project I'm working on gitarray.com