Making CLI Plug-ins Better with a New Architecture

At Heroku, most of us love living in the CLI. Of course, we're absolutely dedicated to providing a great developer experience whether it’s in the dashboard or at the terminal, but we also believe a mastery of the command line interface offers great productivity to you as a developer. A well designed CLI coupled with other small sharp Linux tools provide primitives to build powerful productivity. Today we're introducing an exciting new foundation for the Heroku CLI – an entirely rebuilt plug-in architecture.

This new plug-in infrastructure lays the groundwork for extending the power of the CLI, letting you be more productive than ever before. Want to know if your app is production ready? There’s now a plug-in for you. Want to search your app’s logs with Papertrail? There’s now a plug-in for you.

For many years, the most advanced Heroku users would create their own plug-ins to expand what you could do with the Heroku CLI. Our goal was to make this process easier, so we rethought both plug-in creation and use, and created a better platform for CLI plug-in development. Some of the highlights include:

  • Simple discovery and installation
  • Improved cross platform compatibility
  • Easy plug-in updates and management

To dig a little deeper into what these new plug-ins bring, read on or simply head over to the Dev Center to read our guide for creating them.

Discovery and installation

In the new architecture, plug-ins are npm packages that lay the groundwork for a much smoother experience. Once an npm package is published, you can install it by running heroku plugins:install nameofpackage. For those of you developing plug-ins, it will provide better discoverability of plug-ins, and those of you consuming them will no longer have to hunt through GitHub.

Give it a try with an example plug-in for one of our add-on logging providers Papertrail which helps you manage and search through your logs:

heroku plugins:install heroku-papertrail

Now that you’ve installed it you can immediately begin using your new plug-in to search through your Papertrail logs in the CLI:

heroku pt:logs error
heroku pt:logs -t "H12 OR R14 OR status=503"

As a plug-in developer you specify the heroku-plugin keyword in your package.json and publish it to npm where it’s indexed and searchable. This will better integrate them directly into your Heroku experience and eliminate the need for you to go discover which ones are ready for use vs. a work in progress on GitHub.

Why Node

A common question we’ve heard is: why the migration to Node for our plug-in architecture? We’re still Ruby fans but we also firmly believe in using the right tool for the right job, in this case we felt Node offered some key benefits. When it comes to creating a great CLI experience we wanted no platform (Linux, OS X, Windows) to feel superior to the other, but rather wanted all to have a great and powerful CLI experience should you choose to use it. The Node ecosystem of packages brings broader coverage of cross-platform compatibility, meaning you can simply use many of the packages you’d like to develop plug-ins more quickly and easily while not having to worry about as many compatibility issues.

What’s next

Today we’re excited to release this update for the Heroku Toolbelt, making it easier for you to add and contribute to the powerful ways in which others use Heroku. We’ve already got some great examples of new plug-ins:

If you’ve got an idea for how to improve and expand the Heroku toolbelt, then get started building today.

Browse the blog archives, subscribe to the full-text feed, or visit the engineering blog.