Meshery CLI Contributing Guidelines
These guidelines are a collection of principles and conventions that need to be followed while designing mesheryctl commands.
Design Principles
1. Consistency is quality.
- Consistency of interaction drives a *quality* user experience. Whether that experience is delightful or painful is a related, but separate consideration. Mesheryβs behavior of user interactions should be consistent even when their user experience is poor.
2. Intuitive user experiences feel natural to users.
- When being designed, each of Mesheryβs user experiences should be examined first from the userβs perspective.
Commands should be designed in such a way that they are intuitive. Users should ideally be able to understand what a command is used for without having to extensively go through the documentation.
For example, mesheryctl pattern apply -f <pattern name>
requires no further clarification as it is evident that the command will apply the pattern specified.
Consistency is key when designing intuitive interfaces. Although mesheryctl perf run -f <performance profile name>
may sound more intuitive, users who are experienced in using the CLI will prefer the consistant verb apply
over run
. This will also ensure a consistent command language making memorizing easier. Consistency should also be enforced when chaining commands and using flags.
For example, if mesheryctl pattern
has a list
and view
command and has an -all
and --output
flag, then, similar commands like mesheryctl perf
should also support the same commands and flags and provide a consistent user experience.
Rational defaults overriden with flags
Default behaviour should be optimised for what users will need to do most of the time.
These assumed defaults should be easily overriden by the user with flags.
For example, mesheryctl system context create <context name>
assumes a default platform for the created context. But this can be easily overriden with the --platform
flag.
User Experience: GUI vs CLI
Ideally, all functionality provided in Meshery UI should be available to users via CLI (in mesherctl
). Meshery strives for parity of functionality between itβs two clients. For example, viewing a performance profile in the GUI and with mesheryctl system perf view <profile name>
in the CLI should show the same data.
Command line interfaces offer less context to the user, which makes them inherently less intuitive compared to graphical user interfaces. Both of these user interfaces, however, are the same in that they are both clients of Meshery Server. Both clients are a user experience and as such, to be attended to in this way. The following considerations should be accounted for when designing mesheryctl
experiences:
- Provide only relevant output. Use βdebugβ logs that can be accessed with
--verbose
flag wherever needed. - Add headers to output to give context to the user.
- As mentioned above, similar commands should behave similarly.
- Confirm steps for risky commands. For example, use the
AskForConfirmation
function which will prompt the user to type in βyesβ or βnoβ to continue. - Anticipate user actions. If the user creates a new context with
mesheryctl system context create
then the next action might bemesheryctl system start
to start Meshery otmesheryctl system context switch
to switch context names. - Anticipate user errors. For example, if the user types in
mesheryctl system satrt
, using the inbuilt features with the cobra library, we can correct it tostart
and alert the user.
Process
Contributor-facing Design Artifacts
The following table outlines a set of design artifacts produced in the process of creating and implementing functional specifications.
Document | Purpose |
Meshery CLI Commands & Documentation | Overarching index of all mesheryctl commands |
Meshery CLI Design Specification - See Creating a Functional Specification | Breakout of individual command purpose, syntax, flags, and behavior. Links to these separate, breakout documents should be pasted into the Meshery CLI Commands & Documentation doc. |
Mesheryctl Command Matrix | A spreadsheet of all commands, subcommands and flags with an indication of their implementation status would be most helpful for both documentation and planning purposes. |
User-facing Documentation Artifacts
The following table outlines a set of design artifacts produced in the process of creating and implementing functional specifications.
Document | Purpose |
mesheryctl Command Reference | Overarching index in the form of succinct, categorized, and tabularly displayed reference of all commands and their syntax with simple example usage. |
mesheryctl <name of command> |
Breakout of individual command purpose, syntax, flags, and behavior. Links to these separate, breakout documents should be available from the mesheryctl Command Reference. |
When designing for the CLI, considerβ¦
What the command does
What makes sense to do from a terminal? What doesnβt? What might people want to automate? What is the default behavior? What flags might you need to change that behavior? What might people try and fail to do and how can you anticipate that?
What the command is called
What should be the command language? (mesheryctl <command> <subcommand> [args] [flags] [value]
)
What should be a command vs a flag?
How can you align the language of the new command with the existing commands?
What the command outputs
How can you make the GUI and the CLI outputs similar? What should be outputted normally and what falls into debug logs?
How you explain your command
You will need to provide a short and long description of the command for the help pages and also for the Meshery Documentation.
Proposing new features / creating a design specification
If you are working on a new command or adding a new feature on an existing command, it is recommended to setup a design spec so that other contributors can weigh in on the design before you start to code.
Broader features should have a design specification created in the form of a Google Doc. Refer to βProcess: Creating a Functional Specification or other Documentβ, which has detailed information on creating a design specification.
For small changes, communicating over the issue tracker or the discussions will be helpful.
Suggested Reading
- Build & Release (CI) - Details of Meshery's build and release strategy.
- Contributing to Meshery Adapters - How to contribute to Meshery Adapters
- Contributing to Meshery CLI - How to contribute to Meshery Command Line Interface.
- Contributing to Meshery's End-to-End Tests using Cypress - How to contribute to End-to-End Tests using Cypress.
- Contributing to Meshery Docker Extension - How to contribute to Meshery Docker Extension
- Contributing to Meshery Docs - How to contribute to Meshery Docs.
- How to write MeshKit compatible errors - How to declare errors in Meshery components.
- Contributing to Meshery using git - How to contribute to Meshery using git
- Contributing to Model Components - How to contribute to Meshery Model Components
- Contributing to Model Relationships - How to contribute to Meshery Models Relationships, Policies...
- Contributing to Models Quick Start - A no-fluff guide to creating your own Meshery Models quickly.
- Contributing to Models - How to contribute to Meshery Models, Components, Relationships, Policies...
- Contributing to Meshery Policies - How to contribute to Meshery Policies
- Contributing to Meshery Server Events - Guide is to help backend contributors send server events using Golang.
- Contributing to Meshery UI - Notification Center - How to contribute to the Notification Center in Meshery's web-based UI.
- Contributing to Meshery UI - Sistent - How to contribute to the Meshery's web-based UI using sistent design system.
- Contributing to Meshery's End-to-End Tests - How to contribute to End-to-End Tests using Playwright.
- Contributing to Meshery UI - How to contribute to Meshery UI (web-based user interface).
- Contributing to Meshery Server - How to contribute to Meshery Server
- Setting up Meshery Development Environment on Windows - How to set up Meshery Development Environment on Windows