Developing for Zowe CLI

Last Updated: 11/29/2018, 11:37:30 AM

Developing for Zowe CLI

You can extend Zowe CLI by developing plug-ins and contributing code to the base Zowe CLI or existing plug-ins.

Note: You can also install existing plug-ins to Zowe CLI.

How can I contribute?

You can contribute to Zowe CLI in the following ways:

  1. Add new commands, options, or other improvements to the base CLI.
  2. Develop a plug-in that users can install to Zowe CLI.

See Getting Started to get started with development today!

You might want to contribute to Zowe CLI to accomplish the following:

  • Provide new scriptable functionality for yourself, your organization, or to a broader community.
  • Make use of Zowe CLI infrastructure (profiles and programmatic APIs).
  • Participate in the Zowe CLI community space.

The following plug-in projects have been developed:

Getting started

If you want to start working with the code immediately, check out the Zowe CLI core repository and the contribution guidelines.

The zowe-cli-sample-plugin GitHub repository contains a sample plug-in that adheres to the guidelines for contributing to Zowe CLI projects. Follow the associated developer tutorials to learn about how to work with our sample plug-in, build new commands, or build a new Zowe CLI plug-in.

Tutorials

Follow these tutorials to get started working with the sample plug-in:

  1. Setting up - Clone the project and prepare your local environment.
  2. Installing a plug-in - Install the sample plug-in to Zowe CLI and run as-is.
  3. Extending a plug-in - Extend the sample plug-in with a new by creating a programmatic API, definition, and handler.
  4. Creating a new plug-in - Create a new CLI plug-in that uses Zowe CLI programmatic APIs and a diff package to compare two data sets.
  5. Implementing user profiles - Implement user profiles with the plug-in.

Plug-in Development Overview

At a high level, a plug-in must have imperative-framework configuration (sample here). This configuration is discovered by imperative-framework through the package.json imperative key.

In addition to the configuration, a Zowe CLI plug-in will minimally contain the following:

  1. Programmatic API - Node.js programmatic APIs to be called by your handler or other Node.js applications.
  2. Command definition - The syntax definition for your command.
  3. Handler implementation - To invoke your programmatic API to display information in the format that you defined in the definition.

Developer Documentation and Guidelines

In addition to the tutorials, the following guidelines and documentation will assist you during development:

Imperative CLI Framework Documentation

Imperative CLI Framework documentation is a key source of information to learn about the features of Imperative CLI Framework (the code framework that you use to build plug-ins for Zowe CLI). Refer to these supplementary documents during development to learn about specific features such as:

  • Auto-generated help
  • JSON responses
  • User profiles
  • Logging, progress bars, experimental commands, and more!

Contribution Guidelines

The Zowe CLI contribution guidelines contain standards and conventions for developing Zowe CLI plug-ins.

The guidelines contain critical information about working with the code, running/writing/maintaining automated tests, developing consistent syntax in your plug-in, and ensuring that your plug-in integrates with Zowe CLI properly:

For more information about ... See:
General guidelines that apply to contributing to Zowe CLI and Plug-ins Contribution Guidelines
Conventions and best practices for creating packages and plug-ins for Zowe CLI Package and Plug-in Guidelines
Guidelines for running tests on Zowe CLI Testing Guidelines
Guidelines for running tests on the plug-ins that you build Plug-in Testing Guidelines
Versioning conventions for Zowe CLI and Plug-ins Versioning Guidelines