CLI - Push / Pull / Clone

The Agility CLI (Command Line Interface) is an NPM package that allows you to pull, push, or clone an instance from your console. 

About the Agility CLI

  • Provides features to perform operations to login to agility instance, pull the instance, push the instance and clone the instance (coupling of push and pull operations).
  • Provides logs on failed records for content and layouts.
  • Ability to generate Content and Layouts in bulk for a Website.

Please note that the Agility CLI is currently in beta with frequent updates. Please use our Github issue tracker to provide feedback: https://github.com/agility/agility-cli/issues

Getting Started

Installation

Using npm

  • To install the CLI locally using NPM, open the terminal and type: npm i @agility/cli.
  • For global installation using NPM, open the terminal and type: npm i @agility/cli -g

Using yarn

  • To install the CLI locally using yarn, open the terminal and type: yarn add @agility/cli.
  • For global installation using yarn, open the terminal, and type: yarn global add @agility/cli.

Using the CLI

Athenticate first

  • Login to your agility instance using the command agility login.
  • A browser window will appear to perform the authentication process. You may have to authorize before proceeding.
  • Once authenticated use the following steps to perform operations on your instance.

Performing operations on CLI

  • To pull an instance use the command agility pull --guid="<<Provide Guid of your Instance>>" --locale="<<Provide the locale of the Instance>>" --channel="<<Provide the sitemap to be pulled>>" to pull an instance.
  • To push an instance use the command agility push --guid="<<Provide the target Instance guid>> --locale="<<Provide the locale of the Instance>>"
  • For instance cloning, this command is a mix of push and pull. Use the command agility clone --sourceGuid="<<Provide Guid of your source Instance>>" --targetGuid="<<Provide the target Instance guid>>" --locale="<<Provide the locale of the Instance>>" --channel="<<Provide the sitemap to be cloned>>" to perform cloning between instances.
  • To access the error logs, navigate to .agility-files/logs/instancelog.txt

Folder Structure

  • If a pull or clone instance is initiated, a local folder .agility-files is created.
  • Assets are saved inside the assets folder which consists of a json folder which has the metadata of the assets downloaded. The folder structure is .agility-files/assets/json for metadata. Rest assets are present inside the assets folder.
  • Galleries are saved inside the .agility-files/assets/galleries in a json format which is the metadata of the galleries of your source instance.
  • Containers metadata is present inside .agility-files/containers folder.
  • For example, if the locale is en-us, then the Layouts and Content metadata is present inside the folder .agility-files/en-us/item for Content and .agility-files/en-us/pages. These are the base folders to create Content and Layouts to perform CLI push/clone. There are other folders created i.e. list, nestedsitemap, page, sitemap, state and urlredirections, which are not used by the CLI but are part of pull operation.
  • Models metadata is present inside .agility-files/models folder.
  • Layouts metadata is present inside .agility-files/templates folder.