For the plugin binary to be usable as a Tanzu CLI plugin, it must meet a set of requirements. These requirements are also referred to as the plugin contract.
Since the primary means through which the CLI interacts with plugins is via plugin command invocation. The contract that each plugin has to satisfy can be summarized as a set of commands it is expected to implement.
This command provides version information about the plugin. The CLI user may use this command to obtain the plugin's version as well.
This command provides metadata about the plugin that the CLI will use when presenting information about plugins or when performing lifecycle operations on them.
The output of the command is a JSON structure, like this:
{
"name": "builder",
"description": "Build Tanzu components",
"target": "global",
"version": "v0.90.0",
"buildSHA": "3531c92c",
"digest": "",
"group": "Admin",
"docURL": "",
"completionType": 0,
"pluginRuntimeVersion": "v0.82.0"
}
This command provides a means for a plugin to optionally implement some logic to be invoked right after a plugin is installed. To provide a customized post-install behavior, plugin developers should provide a PostInstallHook as part of the PluginDescriptor. Said function will be called when the post-install command is invoked (which happens every time a plugin is installed).
This command generates a tree of markdown documentation files for the commands
the plugin provides. It is typically used by the CLI's generate-all-docs
command to produce command documentation for all installed plugins.
Validate the command name and arguments to flag any new terms unaccounted for in the CLI taxonomy document. Authors are highly encouraged to follow the CLI Style Guide and adhere to the taxonomy where possible to minimize violations flagged by this command.
It should be apparent that the above-mentioned command names are reserved for the purpose of the plugin contract and are thus unavailable for implementing plugin-specific functionality.
The plugin contract can be met with minimal effort by integrating with the tanzu-plugin-runtime library. This is accomplished by instantiating a new Plugin object and supply some plugin-specific metadata along with it. For more details, see the "bootstrapping a plugin project" section of the plugin developer guide