The Event
On Friday, July 20, 2018, developers from around the world participated in the first-ever WP-CLI Hack Day. The primary goal for this event, which began at 8:00 a.m. Central European Summer Time (that’s 2:00 a.m. in the US east coast!), was to address 20 open issues—bug reports, enhancements, documentation requests, feature modifications and more—and get code that implements these changes merged back into the project in preparation for a future release. A secondary, equally important goal was to determine whether coordinating a specific block of time for developers to contribute would increase community engagement, raise awareness of the utility, and garner interest by developers in contributing to the project on a more regular basis.
As you may know, WP-CLI is another way to interact with information stored in the WordPress database. Instead of viewing information via the browser (by way of a site’s frontend or via its administrator interface), developers can use commands in their preferred command-line tool to do simple operations such as viewing a list of posts, updating user permissions, or flushing permalinks, or more complex tasks like writing custom SQL queries, initializing tests, and scaffolding code for custom plugins and themes.
Despite the early-morning start time (1:00 a.m. in Minnesota where I’m based), I was eager to participate in the WP-CLI Hack Day so I could get a better understanding of how WP-CLI is put together and figure out a way to leverage my skills to contribute to the project in a meaningful way. WebDevStudios regularly gives back to WordPress as part of Matt Mullenweg’s “Five for the Future” challenge, and I was delighted that the company was willing to contribute my Friday workday to join in the event.
Results
How did it go? Though our crew fell short of our goal of 20 merged pull requests, we did manage to close 12 issues and open pull requests for 13 additional ones. During the post-day conference call, we had as many as 13 participants on the call at once. Alain Schlesser, the maintainer of the project, declared it to be a resounding success. You can read a full wrap-up of the day’s events over on make.wordpress.org.
I managed to close one ticket myself, which introduces a new hook—`cli_init`— to the WordPress initialization process. This hook will allow developers to initialize their custom WP-CLI commands during this process, instead of checking for the existence of the `WP_CLI` constant (the latter approach will still be an available option).
The code itself for adding the hook was fairly trivial and, in fact, the solution we wound up going with had been suggested by another developer. Code submitted to the WP-CLI project needs to be tested, however, so my true contribution was writing a behavioral test in Behat. I have been interested in Behat since seeing Jessica Mauerhan’s “Double Loop” tutorial on test-driven and behavior-driven development at Lone Star PHP in 2017, and I was glad to finally have an opportunity to take some of what I had learned at the conference and apply it to a real world project. I’m looking forward to building upon this experience at WP-CLI Hack Day to take my unit testing and behavioral testing knowledge to the next level.
Summary
Staying up all night to participate in WP-CLI Hack Day was an exhausting but a thoroughly rewarding experience. I started the evening with little sleep and little experience about how the tool is actually built, and I came away with a pull request merged into master and ready for the next release. I got to chat with others who are interested in making WordPress, its tools, and its community better. Most importantly, I learned some new things and got to do something I love as part of my job here at WebDevStudios—giving back to great open source projects.
The first WP-CLI Hack Day was a rousing success, and I’m grateful to have had a chance to take part of it.