Skip to content

Miva CLI - Getting Started#


To install run the following command and add the install directory to your path. Prerequisites include having python (3.6 or higher) and pip installed locally.

Project Repository

Installation#

pip3 install --user miva-mmt

To install with elevated privileges and run, which will install the tool for everyone on the local machine.

pip3 install miva-mmt

Update#

To update run the following command.

pip3 install --upgrade miva-mmt

Rollback#

Rollback Procedure.

pip3 uninstall miva-mmt
pip3 install miva-mmt==1.0.2

Token Authentication#

To create token credential type within the Miva Command Line Tool an API Token will need to be created within the Miva admin.

Navigate to Settings > User Management > API Tokens. Select Add API Token button.

CLI API Token

Name: Required to create a token

Access Token: Need to set up credential in the Miva Command LineTool

Allowed IP Address(es): Each access token is restricted to a list of IP addresses you want to have access to make API calls. It accepts a comma separated list of IPs. If you don’t have static IP addresses, you can disable it by using 0.0.0.0/0 which will allow any IP address. You may also need to whitelist the short hand for ipv6 which is: ::/0

Signature:This is required for the Miva Command Line Tool and will be used when setting up a credential.

Timestamp: The command line tool will work with either Timestamp option selected as it automatically adds the timestamp, but it is recommend to require it for security purposes.

After the token has been created the User Interface group needs to be assigned and can be done by selecting the checkbox next to record then selecting the batch list action […] button. In the dropdown select the Groups option to bring up the assigned group dialog box. In the batch list, assign the User Interface group to the API token and close the dialog box.

CLI Token Groups

SSH Authentication#

In order to use an SSH credential type a public and private key must be generated. Miva only supports ssh-rsa format SSH Keys and not DSA, ed25519 or ECDSA. One way to generate an SSH key in the command line interface is to use:

$ ssh-keygen -t rsa -m pem

This will generate both a public and private key file on the local device. The public key file will have a “.pub” extension and this value should be copied into the Miva user under: Edit Profile -> Manage SSH Authentication. Keep note of the private key path as that will be needed when setting up the ssh credential type within the command line tool.

CLI SSH Auth

CLI SSH Token

SSH Pre-Provide#

An example pre-provide.xml showing how the tag can be populated with the public key to save a step while working with mmt on a store

<Provision oncomplete="delete">
    <Domain>
        <User_Delete name="MIVA_USERNAME"></User_Delete>
        <User_Add>
            <Name>MIVA_USERNAME</Name>
            <Password>SECURE_PASSWORD_HERE</Password>
            <Email>YOUR_EMAIL</Email>
            <!-- If using 2FA possible types: totp, yubicloud -->
            <TwoFactorAuthentication type="yubicloud">
                <YubiKeyID>YOUR_YUBIKEY_ID_FIRST_12_CHARACTERS</YubiKeyID>
            </TwoFactorAuthentication>
            <TOTPKey></TOTPKey>
            <ForcePasswordChange>Yes</ForcePasswordChange>
            <DefaultPagination>1000</DefaultPagination>
            <Administrator>1</Administrator>
            <SSHAuthentication>ssh-rsa xxxxxxxxxxxxxxxxxxx ... </SSHAuthentication>
        </User_Add>
    </Domain>
</Provision>

Directory Output#

MMT will create the following directories when using mmt checkout

  • css: CSS templates within the CSS Resources section of the Miva admin

  • js: JS templates within the JS Resources section of the Miva admin

Note

Resources with the type of Module (Managed) will not have the template included

  • properties

    • category
      • cssui_cattitle: Templates for categories that have a title
      • cssui_cattree: Templates for categories that have a category tree image
      • footer: Templates for categories that have a footer
      • header: Templates for categories that have a header
    • cssui_button: Templates found within Global Settings > Buttons
    • flex: Flex components JSON found in the store (informational files only)
    • readytheme_banner: JSON setting files for each Theme Component > Banner in the store
    • readytheme_contentsection: JSON settings and template files (.mvt) for each Theme Component > Content record in the store
    • readytheme_image: JSON setting files for each Theme Component > Image in the store
    • readytheme_lookandfeel: JSON setting file for the Theme Component > Settings section in the store
    • readytheme_navigationset: JSON settings and template files (.mvt) for each Theme Component > Navigation Sets record in the store
    • readytheme_productlisting: JSON settings and template files (.mvt) for each Theme Component > Product Listing record in the store
    • templateorderemail: JSON setting file for the each Emails record in the store
  • resourcegroups: JSON setting file for the each CSS/JavaScript Resources > Resource Groups record in the store

  • templates: JSON settings and template files for Page templates and flex components template files (.mvt)

MMT Snippets#

MMT Snippets streamline the development process by providing quick access to commonly used commands and phrases within VS Code. These snippets are designed to enhance your efficiency and productivity when using MMT with VS Code. To use you will have to write the command in a file or VS code window, but then you can copy/paste the final command into the terminal.

MMT Additional Notes#

MMT Only applies to:

  • Page-templates and those templates’ settings
  • ReadyTheme/Theme Components (Banners, Images, Content Sections, Navigation Sets, Product Listings)
  • JS & CSS Resource Groups
  • Product & Category Header/Footer templates

The following features/changes are not isolated to Template Branches:

  • Creating/Deleting Pages
  • Page Item Assignments
  • Module Settings
    • Payment Rules
  • Shipping Rules
  • Price Groups
  • Any other modules’ settings
  • Store & Domain Settings
  • URIs